Show 13 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
> >> 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.
> > True, but the src:dst on the command line in your example is still
> overriding the .fetch configuration. Wouldn't it make it confusing
> if it overrode .fetchRefmap configuration, since src:dst on the
> command line is what .fetch configuration gives the defaults for
> (and .fetchRefmap configuration gives the defaults for --refmap, not
> the refspec like src:dst). It may be just as confusing as if, say, a
> command line --refmap suddenly started overriding .fetch
> configuration, I am afraid.
I think it depends on whether users already know how --refmap works. My contention is that they don't and are used to src:dst on the commandline overriding their config and will therefore be confused when it does not override .fetchRefmap. If one took the view that users are already familiar with what happens when they pass --refmap and src:dst then I agree changing the behavior would be confusing, but I don't think most users even know --refmap exists let alone what it does in this particular corner case. I had a look to see if the current behavior of --refmap combined with src:dst is documented, all I could see was
When git fetch is run with explicit branches and/or tags
to fetch on the command line, e.g. git fetch origin master,
the <refspec>s given on the command line determine what are to
be fetched (e.g. master in the example, which is a short-hand
for master:, which in turn means "fetch the master branch but I
do not explicitly say what remote-tracking branch to update with
it from the command line"), and the example command will fetch
only the master branch. The remote.<repository>.fetch values
determine which remote-tracking branch, if any, is updated. When
used in this way, the remote.<repository>.fetch values do not
have any effect in deciding what gets fetched (i.e. the values
are not used as refspecs when the command-line lists refspecs);
they are only used to decide where the refs that are fetched are
stored by acting as a mapping. The latter use of the remote.<repository>.fetch values can be
overridden by giving the --refmap=<refspec> parameter(s) on the
command line.Which reads to me that --refmap overrides remote.<repository>.fetch when remote.<repository>.fetch is used as a mapping. As remote.<repository>.fetch is not used as a mapping when there is a explicit destination on the commandline, it is not clear to me that the current behavior of --refmap combined with src:dst on the commandline matches the documentation.