Subject: Re: [PATCH v11] checkout: extend --track with a "fetch" mode to refresh start-point

From: Phillip Wood <[email-masked]>
Date: Thu, 21 May 2026 10:49:13 +0100

On 19/05/2026 11:34, Junio C Hamano wrote:
> "Harald Nordgren via GitGitGadget" <[email-masked]> writes:
> 
>>      checkout: --track=fetch
>>      
>>       * Find the right remote by checking which remote's fetch refspec maps
>>         to the user's start-point, instead of assuming the start-point begins
>>         with the remote's name. This fixes cases where the user has a custom
>>         refspec mapping into a namespace whose name differs from the remote
>>         (e.g. fetching from origin into refs/remotes/upstream/*).
> 
> This comment is even before looking at the patch text.  After
> getting one issue pointed out, I'd expect you to think about related
> issues before sending a new round out.
> 
> One.  Have you considered the case where the remote-tracking refs
> are overlapping, e.g., where "origin" and "upstream" point at
> different URLs but they both store in "refs/remotes/upstream/*"?
> Perhaps their URLs may textually be different but are pointing
> logically at the same place (e.g., one ssh:// the other https:// for
> example).
> 
> What should happen?  What does happen after you apply this patch?

It would be worth looking at what "git checkout --track" does in that 
case and seeing if we can share the code.

Thanks

Phillip

> 
>>       * For a bare namespace name, follow <namespace>/HEAD first to figure
>>         out which branch to fetch.
> 
> What should happen if HEAD does not exist?  What does happen after
> you apply this patch?
> 
> Thanks.
>