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

Re: [PATCH] clone: add remote.cloneDefault config option

From
Sean Barag <sean@barag.org>
Date
Aug 27, 2020, 03:38 UTC
Message-ID
<20200827033854.130005-1-sean@barag.org>
In-Reply-To
<xmqqeentuqk5.fsf@gitster.c.googlers.com>
Show 26 quoted lines
> Derrick Stolee <stolee@gmail.com> writes:
> 
>> 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.

Perfect, I'll move forward with `clone.defaultRemoteName`. Thanks for the recommendation. This would be the first config variable inside the a "clone" subsection -- is there anything special that needs to happen when a new subsection is added?

Show 10 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.

Agreed - I'm sorry for not including those tests. They'll be present in v2. I'll be sure to include some validation for `clone.defaultRemoteName` within `git_config` as well.

Show 13 quoted lines
> It is somewhat sad that we have the git_config(git_default_config)
> call so late in the control flow.  I wonder if we can update the
> start-up sequence to match the usual flow
> ...
> One oddity "git clone" has is that it wants to delay the reading of
> configuration files (they are read only once, and second and
> subsequent git_config() calls will reuse what was read before [*]) so
> that it can read what clone.c::write_config() wrote, so if we were to
> "fix" the start-up sequence to match the usual flow, we need to
> satisfy what that odd arrangement wanted to achieve in some other way
> (e.g. feed what is in option_config to git_default_config ourselves,
> without using git_config(), as part of the "main control flow uses the
> variable" part), but it should be doable.

Sounds like a pretty big change! I'm willing to take a crack at it, but given that this is my first patch I'm frankly a bit intimidated :) How would you feel about that being a separate patch?

Thanks for all the guidance, folks. Sean

Previous: Junio C HamanoNext: Junio C Hamano
Message 5 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.