Re: [PATCH] fetch: add config to avoid fetching every branch in shallow repo
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 24, 2026, 18:02 UTC
- Message-ID
- <xmqqa4p634tx.fsf@gitster.g>
- In-Reply-To
- <CALnO6CA5b7mpia9tkiOENdOKcOHF4errc31wuF5n5-=rrbHxVw@mail.gmail.com>
"D. Ben Knoble" <ben.knoble@gmail.com> writes:
Show 18 quoted lines
>> Having said that, I suspect that the fact that you have the >> shorthand 'second' (i.e., you have "[remote "second"] url = ..." >> defined) may be a good enough sign that you expect to keep >> interacting with that repository, and some people might appreciate >> it if >> >> $ git fetch second main >> >> created a remote-tracking branch "refs/remotes/second/main" >> automatically. >> >> But we cannot suddenly start doing so without breaking people's >> expectations, and without a good transition plan. We need at least >> an escape hatch for users to say "No, this is a single-shot fetch; >> do not write the object anywhere other than FETCH_HEAD as we have >> always done". > > So anyway, I think fetch.<remote>.refmap is the right thing here, thanks!
Ahh, yes, if we introduce fetch.second.refmap that makes it pretend as if you gave a --refmap argument on the command line, your
$ git fetch second main
will automatically do what you want it to do. I didn't realize that it was the implication of what I was outlining while preparing the response to Harald ;-)
Thanks.