Re: [PATCH v2 5/5] builtin/upload-pack: set GIT_NO_LAZY_FETCH to 0 on trusted repo
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Sep 8, 2026, 17:02 UTC
- Message-ID
- <CAP8UFD07ssLAAsc_00W3Q=vzPXry-=nK-mO66_eoHxEGTEYAgw@mail.gmail.com>
- In-Reply-To
- <xmqq1pc0mr5i.fsf@gitster.g>
On Fri, Aug 14, 2026 at 9:35 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> To somebody who designed this mechanism, it may have been clear that > you are talking about multi-valued configuration variable, i.e., > > [uploadpack] > lazyFetchTrusted = repo1 > lazyFetchTrusted = repo2 > ... > lazyFetchTrusted = repoN > > but the "config entries specify repositories" can be misread to mean > > [uploadpack] > lazyFetchTrusted = repo1 repo2 ... repoN > > especially combined with the use of verb "list" in "Listing a > repository here tells..." we see below. > > A multi-valued configuration variable, each of which names a > repository that `upload-pack` is allowed to ... > > or something, perhaps. Say that upfront to make sure readers won't > waste their time wondering what the syntax is.
I have used that in the v3 I just sent.
Show 7 quoted lines
> Also, how would one specify a repository? A URL? Remote nickname > used in > > [remote "nick"] url = ... > > configuration? Local directory that houses another repository? > Something else?
The v3 has improved regarding this as I think it makes it clearer that repos are identified by having their git dir, or a parent directory of it, in this config variable.
Show 16 quoted lines
> > + allowed to lazily fetch missing objects for. By default, > > + `upload-pack` refuses to lazily fetch (see the description of the > > + `GIT_NO_LAZY_FETCH` environment variable in > > + linkgit:git-upload-pack[1]), because doing so would run `git fetch`, > > + which may execute arbitrary commands specified in the configuration > > + and hooks of the served repository. Listing a repository here tells > > + `upload-pack` that it is trusted, so lazy fetching from the promisor > > + remotes configured in it is allowed. This is equivalent to setting > > + `GIT_NO_LAZY_FETCH` to `0` for the matching repositories. An > > + explicitly set `GIT_NO_LAZY_FETCH` takes precedence over this > > + setting. > > It would be interesting to set it to point at itself. A client asks > you to serve a pack, you find some objects you yourself do not have > because you fetched lazily from the upstream, and you end up asking > you if you have that object (U+1F61B Face with Stuck-Out Tongue 😛).
Actually it happens that it could recursively lazy fetch in v2, but this has been fixed with a new patch and a few tests in v3. Thanks for the suggestion.
Show 15 quoted lines
> > +Note that this allows lazy fetching from any promisor remote > > +configured in the served repository, not only from the promisor > > +remotes that the client accepted using the "promisor-remote" protocol > > +v2 capability (see linkgit:gitprotocol-v2[5]). The served repository > > +is trusted as a whole, including its configuration, so the promisor > > +remotes it configures are trusted too. It is the server operator's > > +responsibility to make sure that the promisor remotes of a trusted > > +repository are also trustworthy. > > ++ > > +This is a multi-valued setting, i.e. you can add more than one > > +repository via `git config (--global|--system) --add`. To reset the > > +list of trusted repositories (e.g. to override any such repositories > > +specified in the system config), add a `uploadpack.lazyFetchTrusted` > > a -> an before `uploadpack.lazyFetchTrusted`.
Fixed in v3.
Thanks.