Re: [PATCH] clone: add remote.cloneDefault config option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 26, 2020, 19:59 UTC
- Message-ID
- <xmqqeentuqk5.fsf@gitster.c.googlers.com>
- In-Reply-To
- <eeebff99-d585-5575-009e-83bfef5294e3@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 22 quoted lines
> On 8/26/2020 2:46 PM, Junio C Hamano wrote: >> "Sean Barag via GitGitGadget" <gitgitgadget@gmail.com> writes: >>> This commit implements >>> `remote.cloneDefault` as a parallel to `remote.pushDefault`, >>> with prioritized name resolution: >> >> I highly doubt that .cloneDefault is a good name. After reading >> only the title of the patch e-mail, i.e. when the only available >> information on the change available to me was the name of the >> configuration variable and the fact that it pertains to the command >> "git clone", I thought it is to specify a URL, from which "git >> clone" without the URL would clone from that single repository. >> >> And the name will cause the same misunderstanding to normal users, >> not just to reviewers of your patch, after this change hits a future >> Git release. >> >> Taking a parallel from init.defaultBranchName, I would probably call >> it clone.defaultUpstreamName if I were writing this feature. > > I was thinking "clone.defaultRemoteName" makes it clear we are naming > the remote for the provided <url> in the command.
I 100% agree that defaultremotename is much better.
Show 7 quoted lines
>> ... For example >> >> git -c remote.cloneDefault="bad.../...name" clone parent >> >> should fail, no? > > This is an important suggestion.
To be fair, the current code does not handle the "--origin" command line option not so carefully.
Back when the command was scripted, e.g. 47874d6d (revamp git-clone (take #2)., 2006-03-21), had both ref-format check and */* multi-level check, and these checks been retained throughout its life until 8434c2f1 (Build in clone, 2008-04-27) rewrote the whole thing while discarding these checks for --origin=bad.../...name
It would make an excellent #leftoverbits or #microproject.
Thanks.