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

Re: [PATCH] fetch: pass transport to post-fetch connectivity check

From
Kristofer Karlsson <krka@spotify.com>
Date
May 27, 2026, 10:04 UTC
Message-ID
<CAL71e4MrVqC1=AR6x0_8S=8kVqPdDkhgCZRb4etFsxTzd6s_8Q@mail.gmail.com>
In-Reply-To
<20260527083216.GA981444@coredump.intra.peff.net>

You're right. I dug into this further and realized the problem is deeper than just the flag not being set in builtin/fetch.c.

Even if we add: transport->smart_options->check_self_contained_and_connected = 1; to prepare_transport(), the optimization still won't work for fetches.

The optimization is fundamentally clone-only.

I was unable to reproduce the benchmark numbers from my original commit message. The patch as submitted is indeed inert for non-clone fetches. It looked like a simple improvement, but it's clear that it was incorrect. I'll drop it, and I apologize for the noise here.

-- Kristofer
On Wed, 27 May 2026 at 10:32, Jeff King <peff@peff.net> wrote:
Show 31 quoted lines
>
> On Sun, May 24, 2026 at 12:28:12PM +0000, Kristofer Karlsson via GitGitGadget wrote:
>
> > From: Kristofer Karlsson <krka@spotify.com>
> >
> > When fetching with a transport that sets `self_contained_and_connected`
> > (as index-pack does for self-contained packs), check_connected() can
> > use find_pack_entry_one() to skip connectivity verification for refs
> > whose objects exist in the new pack. This avoids sending those OIDs to
> > the rev-list child process.
> >
> > However, store_updated_refs() never passed the transport to
> > check_connected(), so opt.transport was always NULL and this
> > optimization was dead code for post-fetch connectivity checks.
> >
> > Thread the transport parameter through store_updated_refs() and set
> > opt.transport so that check_connected() can take advantage of
> > self-contained packs.
>
> That makes sense in principle, but one thing puzzles me. We only turn on
> the optimization in check_connected() if the transport's smart_options
> has the self_contained_and_connected bit set. And we set that only when
> we were told via check_self_contained_and_connected to do so (and we
> pass the appropriate option to index-pack, which tells us the result is
> OK).
>
> And the only place that turns on check_self_contained_and_connected is
> in builtin/clone.c. So how does this optimization work for a non-clone
> fetch? Am I missing some code path?
>
> -Peff
Previous: Jeff KingNext: Jeff King
Message 5 of 6 in “fetch: pass transport to post-fetch connectivity check”
  1. fetch: pass transport to post-fetch connectivity checkKristofer Karlsson via GitGitGadget, May 24, 2026
  2. Junio C HamanoMay 24, 2026
  3. Kristofer KarlssonMay 24, 2026
  4. Jeff KingMay 27, 2026
  5. Kristofer KarlssonMay 27, 2026
  6. Jeff KingMay 27, 2026

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.