Skip to main content

gc

Function gc 

Source
pub fn gc(stores: &ServerStores, args: GcArgs) -> Result<()>
Expand description

gunnar gc, the repack seam, now driving gunnar-store’s repack().

Each repository’s pushed packs and loose objects are folded into one new pack, which is put in place and verified before anything is removed (never in place). A repository that is already consolidated is reported as such and left alone: rewriting it would churn the pack id and reclaim nothing.

This is not the znippy cold tier repack() describes, and the reason is That tier as specified stores inflated object content, which forecloses pack-copy permanently and makes every cold-tier fetch pay a full recompression. gunnar-store::repack’s module documentation carries the argument. What this verb does is git’s own answer (many immutable containers plus a periodic merge) with the client’s deltas and deflate preserved, which is what verbatim pack copy needs to exist at all.

The per-repository line reports applied outputs: objects, what was folded, what was copied rather than recompressed, and the bytes each way. A gc that printed only “done” would be indistinguishable from one that did nothing (measured, not asserted).

Unreachable objects are kept unless --prune says otherwise. RepackOptions::prune_unreachable had been implemented, tested (gunnar-store/tests/repack.rs) and reachable from nothing: no flag, no caller, so nothing gunnar ever reclaimed the objects of a rejected push, a deleted branch or a force-pushed-away history. It is a separate and destructive decision, which is why it is a flag and not a default, and the number of objects it dropped is reported rather than assumed.