You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A small mirror fetch stays loose, so a shared compiler-tier checkout fetches its history again #1702
With LOOM_CODE_COMPILER_SHARE_MIRROR_PACKS on, a compiler-tier checkout hard-links the mirror's packs (_share_mirror_packs) and nothing else. The mirror's fetches (gitrepo.fetch and the other fetch helpers) run with git's default fetch.unpackLimit of 100, so a fetch of fewer than 100 objects, the usual one-commit change, is stored as loose objects. Those objects never reach the checkout until the mirror's gc packs them, every code_mirror_gc_interval_h (168 h by default).
The checkout's fetch (checkout_fetch_args) then finds the target's closure incomplete and has the mirror send it. A checkout with no ref yet has nothing to negotiate from and receives the mirror's whole history as a second pack beside the linked ones. On a fully packed mirror the same fetch writes nothing.
Measured on a public repository (one 17 GB pack, 3.9 million objects, git 2.43.7, GIT_TRACE2_PERF): a new shared checkout's fetch of the mirror's head writes nothing when the mirror is fully packed (534 s, all of it the connectivity walk). After one more commit fetched loose into the mirror, the same fetch runs pack-objects and index-pack over the whole history, writes a 15.4 GB pack into the checkout and takes 1,591 s.
Does it reproduce on the latest release or main?
Yes
How to reproduce
A bare mirror cloned as Loom clones one (one pack), and LOOM_CODE_COMPILER_SHARE_MIRROR_PACKS=1.
Commit one file in the source and run gitrepo.fetch on the mirror. git count-objects -v in the mirror shows count: 3: the commit, its tree and the blob are loose.
Call resolve_checkout(cfg, "python") for a new checkout and run the tier's fetch of the new head (git fetch <mirror> +<head>:refs/loom/scip-head).
The checkout now holds a pack of its own with the mirror's whole history. Without step 2, the same fetch writes no object.
Expected behavior
Every object the mirror fetched reaches the checkout through the shared packs, so the checkout's fetch transfers nothing the mirror's packs hold. docs/operations/code-index-operations.md says a shared checkout costs its working tree rather than a second copy of the repository.
Environment
main 26f8753bc; git 2.43.7. The fetch helpers are unchanged since pack sharing landed.
Activity