From: Phillip Wood Date: Mon, 26 Oct 2026 09:43:07 GMT Subject: Re: [PATCH v10 0/5] fetch: avoid fetching every branch of a new remote in a shallow repo Message-ID: <101723fc-d392-4000-b224-345c610b2aaa@gmail.com> In-Reply-To: On 24/10/2026 00:13, Junio C Hamano wrote: > "Harald Nordgren via GitGitGadget" writes: > > This topic seeems fairly well done, without seeing any additional > comments in the last two rounds, but I am highly disturbed that I > was practically the only person who reviewd its later iterations. > Because I am not a target audience of the feature, I would not be > surprised if I am missing something large. > > I would very much appreciate if somebody else can give the series > one more read and Ack them, so that we can move it forward. I've just read through the commit messages and documentation changes and I think it is a mistake to use a single config variable to configure where fetched refs are stored and which refs are fetched. The problem this series tries to solve is that the default refspec fetches all the branches from the remote and it's not possible to use that mapping and also restrict which branches are fetched. To fix that it introduces a new config setting to configure where the refs are stored which is good, but it then uses the presence of that setting to implicitly configure the default set of refs to fetch. To me that repeats the mistake of the existing fetch config. It would be much more flexible if we had a separate config setting (maybe remote..fetchRefs) to describe which refs are fetched. 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. Setting remote..fetchRefmap refs/heads/*:refs/remotes//* remote..fetchRefs +refs/heads/* would be equivalent to remote..fetch +refs/heads/*:refs/remotes//* Ideally when we're seeing which refs to fetch we'd use the last entry that matches so that remote..fetchRefs +refs/head/* remote..fetchRefs refs/heads/master would refuse non-fast-forward updates for master. Currently we use the first refspec we find that matches which goes against the usual "last one wins" behavior for config settings and makes it impossible to add per-branch refspecs with "git config" because the default setting comes first in the config file and matches all branches. Thanks Phillip