From: Kristofer Karlsson Date: Wed, 27 May 2026 10:04:19 GMT Subject: Re: [PATCH] fetch: pass transport to post-fetch connectivity check Message-ID: 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 wrote: > > On Sun, May 24, 2026 at 12:28:12PM +0000, Kristofer Karlsson via GitGitGadget wrote: > > > From: Kristofer Karlsson > > > > 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