From: Phillip Wood Date: Thu, 29 Oct 2026 16:26:56 GMT Subject: Re: [PATCH v10 1/5] fetch: add remote..refmap Message-ID: <5a1fc2ca-0ef9-41d2-a02a-a6023cbe09dd@gmail.com> In-Reply-To: On 28/10/2026 17:42, Junio C Hamano wrote: > Phillip Wood writes: > >> >> That makes sense. What should we do if "remote.cabal.refmap" exists and >> "remote.cabal.fetch" contains a colon? We could just ignore that entry >> but it might be better to error out. > > Possible alternatives include > > - giving fetch with dst take precedence over refmap > - storing the result in two locations > - error out not knowing what is the right thing to do > > I think the command line version, i.e. > > $ git fetch $URL --refmap='refs/heads/*:refs/remotes/alt/*' \ > refs/heads/master:refs/remotes/origin/master \ > next > > stores 'master' as alt/master and origin/master, and 'next' as > alt/next, i.e., takes the second option. That's surprising, I'd naively assumed a refspec on the command line would override the refmap. It feels problematic if we cannot override the fetchRefmap config with a refspec on the command line, but need to use "--refmap" instead. I think there are at least a couple of ways of thinking about the interaction of "remote..fetchRefmap" and "remote..fetch". The first is to consider that the "fetchRefmap" config is for "where to store the fetched refs" and the "fetch" config is for "what to fetch". In that case we'd reject values containing colons in the "fetch" config as any mapping should be done by the "fetchRefmap" config. The other way is to consider that the "fetchRefmap" config holds the default argument for "--refmap" and "fetch" holds the default command line refspecs to use when the user doesn't specify any. In that case we should accept "fetch" values containing colons and behave as if those values had been given as command line arguments. I'm leaning towards the latter, but if we do decide to do that, I think we should make sure git -c remote.cabal.fetchRefmap='refs/heads/*:refs/remotes/cabal/*' \ fetch cabal refs/heads/master:refs/remotes/origin/master only updates origin/master and not cabal/master. Thanks Phillip