From: Harald Nordgren Date: Wed, 28 Oct 2026 20:57:22 GMT Subject: Re: [PATCH v10 1/5] fetch: add remote..refmap Message-ID: In-Reply-To: On Wed, Oct 28, 2026 at 7:42 PM Junio C Hamano wrote: > > Phillip Wood writes: > > >> I was hoping that with refmap, the users can tell the system where > >> to store them. As specifying a shorthand also works, > >> > >> [remote "cabal"] > >> fetch = master > >> fetch = next > >> fetch = seen > >> refmap = +refs/heads/*:refs/remotes/cabal/* > >> > >> would be an easy layout to allow adding different branches than > >> having to say > >> > >> [remote "cabal"] > >> fetch = +refs/heads/master:refs/remotes/cabal/master > >> fetch = +refs/heads/next:refs/remotes/cabal/next > >> fetch = +refs/heads/seen:refs/remotes/cabal/seen > > > > 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 The answer seems to be the second one, with my v12, and I wrote a test now to confirm it, I can include it in a v13 when it's time: ``` +test_expect_success 'remote..fetchRefmap stores an explicit-dst remote..fetch entry in both places' ' + test_when_finished "rm -fr fetch-refmap-upstream downstream" && + git init -b master fetch-refmap-upstream && + test_commit -C fetch-refmap-upstream base && + git init downstream && + ( + cd downstream && + git remote add cabal ../fetch-refmap-upstream && + git config --unset-all remote.cabal.fetch && + git config --add remote.cabal.fetch \ + "+refs/heads/master:refs/remotes/custom/master" && + git config remote.cabal.fetchRefmap "+refs/heads/*:refs/remotes/cabal/*" && + git fetch cabal && + check_fetched_refs <<-\EOF + refs/remotes/cabal/HEAD + refs/remotes/cabal/master + refs/remotes/custom/master + EOF + ) +' ``` Harald