Re: [PATCH] fetch: pass transport to post-fetch connectivity check
From: Jeff King <hidden>
Date: 2026-05-27 08:32:23
On Sun, May 24, 2026 at 12:28:12PM +0000, Kristofer Karlsson via GitGitGadget wrote:
From: Kristofer Karlsson <redacted> 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