Re: [PATCH v10 0/5] fetch: avoid fetching every branch of a new remote in a shallow repo
On 26/10/2026 15:44, Junio C Hamano wrote:
Show 12 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
> > When I wrote the refmap feature (without configuration variable)
> long time ago, one of the goals was to allow me to say
> > $ git fetch cabal \
> --refmap="+refs/heads/*:refs/remotes/cabal/*" \
> maint master next
> > That is, "here is the place I grab from there are stored" and
> "maint master next are the things I grab from there" are specified
> separately. With the configuration variable added in this series,
> > $ git config set remote.cabal.refmap "+refs/heads/*:refs/remotes/cabal/*"
> $ git fetch cabal master next seen
> > should become possible with the same behaviour.
Show 13 quoted lines
>> That
>> setting could accept something like "*@{upstream}" to "mean fetch the
>> upstream branches of my local branches that live on this remote" which
>> would cover what this series wants. I think it would be useful to
>> support "+" and "^" prefixes on the refs to fetch as well, so that the
>> refmap config controls the mapping and the "what to fetch" config
>> handles negation and forced updates on a per-ref basis.
> > The reasoning here is slightly wrong. "^" (not) may be good thing
> to consider as it is to decide what to fetch, but "+" (overwrite)
> should be on the refmap side, i.e., where to store. If you are not
> storing, then "overwrite what I have with non-fast-forward" becomes
> a nonsense request, and that is why it does not belong to "what to
> fetch".I see what you're saying. It is unfortunate though that we then need separate refspecs if want to reject non fast-forward updates of some branches but map the refs in the same way for the fast-forward and non-fast-forward cases.
Thanks
Phillip