]> git.ipfire.org Git - thirdparty/git.git/commit
fetch: pass transport to post-fetch connectivity check
authorKristofer Karlsson <krka@spotify.com>
Sun, 24 May 2026 12:28:12 +0000 (12:28 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 May 2026 12:54:12 +0000 (21:54 +0900)
commit95e833e766f3a73d7fd86611cf17272581d64cdf
tree9573e09c6c88e74b1c98f1172dacc37658624e1b
parent6a4418c36d6bad69a599044b3cf49dcbd049cb45
fetch: pass transport to post-fetch connectivity check

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.

On a large repository (2.4M commits, 374K files, 10.9K local refs),
fetching 200 new commits:

  Before: rev-list connectivity check  22s,  total fetch  36s
  After:  rev-list connectivity check   5s,  total fetch  14s

The remaining 5s is spent verifying refs not contained in the new pack.

Signed-off-by: Kristofer Karlsson <krka@spotify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c