git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Derrick StoleeNext: Sean Barag
Message 4 of 7 in “clone: add remote.cloneDefault config option”
  1. clone: add remote.cloneDefault config optionSean Barag via GitGitGadget, Aug 26, 2020
  2. Junio C HamanoAug 26, 2020
  3. Derrick StoleeAug 26, 2020
  4. Junio C HamanoAug 26, 2020
  5. Sean BaragAug 27, 2020
  6. Junio C HamanoAug 27, 2020
  7. Sean BaragAug 27, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.