From: Junio C Hamano Date: Thu, 29 Oct 2026 22:18:45 GMT Subject: Re: [PATCH v10 1/5] fetch: add remote..refmap Message-ID: In-Reply-To: <5a1fc2ca-0ef9-41d2-a02a-a6023cbe09dd@gmail.com> Phillip Wood writes: >> 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. Maybe, maybe not. The command line refmap was meant to primarily help use case where the "what to fetch" was to be specified without colon, so when fetching multiple branches, you do not have to repeat the refs/remotes/origin/ all over again. So if you are giving a refspec with a colon (like 'master' in the above example) to specify where to store, it is an unusual request to do something different. Something different could be "do more than what the refmap alone would do", which led to the behaviour implemented when refmap was introduced. But it could be "refrain from what the refmap alone would do and do something else", and if you take that position, you would get the "overriding" behaviour.