Back to the article

Why Git cleanup is not a performance fix by itself

a clean repository can still repeat expensive work

Some clones save disk space by borrowing objects from another repository, called an alternate object store. The source may consider an object unused even while a borrower needs it. Inventory those dependencies before reclamation; a long-lived publishing clone can be made independent by copying its required objects, including with --dissociate when reference-cloning. Git clone

In this borrowed-store path, we found a separate go-git defect. go-git is a Go library that performs Git operations inside an application. A pack index maps object IDs to locations inside a pack; it is different from the staging index. The reported v5.19.2 path recreated an alternate reader on each local miss, decoding the same pack index repeatedly. The merged fix retains readers for one repository opening. The test described by gh pr view 2512 --repo medici-finance/assay performs 88 object reads: index opens fall from 88 to one. Investigation, fix PR

The test counts repeated index work, not end-to-end push time. Removing obsolete refs reduces the work to inspect; reusing readers avoids doing the same work again. Repository cleanup cannot substitute for this library fix.