git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] fetch: delay fetch_if_missing=0 until after config

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 24, 2019, 04:30 UTC
Message-ID
<xmqqo8y6g3yu.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191023233403.145457-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 20 quoted lines
> Suppose, from a repository that has ".gitmodules", we clone with
> --filter=blob:none:
>
>   git clone --filter=blob:none --no-checkout \
>     https://kernel.googlesource.com/pub/scm/git/git
>
> Then we fetch:
>
>   git -C git fetch
>
> This will cause a "unable to load config blob object", because the
> fetch_config_from_gitmodules() invocation in cmd_fetch() will attempt to
> load ".gitmodules" (which Git knows to exist because the client has the
> tree of HEAD) while fetch_if_missing is set to 0.
>
> fetch_if_missing is set to 0 too early - ".gitmodules" here should be
> lazily fetched.  Git must set fetch_if_missing to 0 before the fetch
> because as part of the fetch, packfile negotiation happens (and we do
> not want to fetch any missing objects when checking existence of
> objects)...

Is it only me to feel that this is piling band-aids on top of band-aids?

Perhaps the addition (and enabling) of lazy-fetch should have been done after "checking existence" calls are vetted and sifted into two categories? Some accesses to objects are "because we need it now---so let's lazily fetch if that is available as a fallback option to us", as opposed to "if we do not have it locally right now, we want to know the fact". And each callsite should be able to declare for what reason between the two it is making the access.

The single fetch-if-missing boolean may have been a quick-and-dirty way to get the ball rolling, but perhaps the codebase grew up enough so that it is time to wean off of it?

Previous: Jonathan TanNext: Jonathan Tan
Message 6 of 11 in “fetch: delay fetch_if_missing=0 until after config”
  1. fetch: delay fetch_if_missing=0 until after configJonathan Tan, Oct 7, 2019
  2. Emily ShafferOct 23, 2019
  3. fetch: delay fetch_if_missing=0 until after configJonathan Tan, Oct 23, 2019
  4. Emily ShafferOct 23, 2019
  5. fetch: delay fetch_if_missing=0 until after configJonathan Tan, Oct 23, 2019
  6. Junio C HamanoOct 24, 2019
  7. Jonathan TanOct 24, 2019
  8. Junio C HamanoOct 25, 2019
  9. Jonathan TanOct 25, 2019
  10. Junio C HamanoOct 29, 2019
  11. Jonathan TanNov 1, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.