From: Junio C Hamano Date: Tue, 27 Oct 2020 22:09:49 +0000 (-0700) Subject: Merge branch 'sb/clone-origin' X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=40696c67274305d6258539de5a36649cf833f712;p=git.git Merge branch 'sb/clone-origin' "git clone" learned clone.defaultremotename configuration variable to customize what nickname to use to call the remote the repository was cloned from. * sb/clone-origin: clone: allow configurable default for `-o`/`--origin` clone: read new remote name from remote_name instead of option_origin clone: validate --origin option before use refs: consolidate remote name validation remote: add tests for add and rename with invalid names clone: use more conventional config/option layering clone: add tests for --template and some disallowed option pairs --- 40696c67274305d6258539de5a36649cf833f712 diff --cc builtin/clone.c index 391aa41075,a144e7f35b..a0841923cf --- a/builtin/clone.c +++ b/builtin/clone.c @@@ -1154,10 -1195,11 +1194,10 @@@ int cmd_clone(int argc, const char **ar if (option_sparse_checkout && git_sparse_checkout_init(dir)) return 1; - remote = remote_get(option_origin); + remote = remote_get(remote_name); - strbuf_addf(&default_refspec, "+%s*:%s*", src_ref_prefix, - branch_top.buf); - refspec_append(&remote->fetch, default_refspec.buf); + refspec_appendf(&remote->fetch, "+%s*:%s*", src_ref_prefix, + branch_top.buf); transport = transport_get(remote, remote->url[0]); transport_set_verbosity(transport, option_verbosity, option_progress);