Re: [PATCH v14 1/5] fetch: add remote.<name>.fetchRefmap
Hi Harald
On 14/11/2026 18:38, Harald Nordgren via GitGitGadget wrote:
Show 20 quoted lines
> > +test_expect_success 'remote.<name>.fetchRefmap stores an explicit-dst remote.<name>.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
> + )
> +'
This behavior arguably isn't too bad when "--refmap" is given on the command line because the user can simply adjust the refmap argument or the commandline refspec if they don't want to ref to be stored in two places. The same is true for when the refmap comes from the ".fetchRefmap" config and the refspec comes form the ".fetch" config. Both those cases could probably be filed under "if it hurts don't do it". However, I think it becomes confusing if we store the ref in two places when the user configures ".fetchRefmap" and then passes "src:dst" on the commandline because users are used to a commandline "src:dst" overriding the ".fetch" config, not adding to it. It is going to be very awkward for users if they cannot override ".fetchRefmap" by passing "src:dst" on the commandline. I think we should change the behavior so that "--refmap" and the ".fetchRefmap" config are ignored when the user includes an explicit destination on the commandline or the in ".fetch" config.
Thanks
Phillip