Skip to main content

Module sections

Module sections 

Source
Expand description

GitIndexBuilder — turns a set of git objects into the three reserved sections a git-format archive carries.

The caller (gunnar’s repack(), or a test) hands over the canonical bytes of every object it is sealing. The builder derives each object’s oid by hashing those bytes, so the oid it indexes and the relative_path the archive stores cannot drift apart — there is no second place where an oid is spelled.

Payloads are retained only for commits and trees. Blobs are leaves in the reachability graph and contribute nothing but their oid, so their bytes are dropped as soon as they are hashed. On a real repository that is the difference between holding the metadata and holding the repository.

The oid index needs lookup row numbers, which only exist once the sink has sorted the lookup — hence GitIndexBuilder::into_reserved_builder, which defers exactly that step to ArrowIpcSink::finish.

§Two tiers, one seal path

A git archive holds a repository one of two ways, and the builder has a constructor for each:

constructordata entriesderived sections
GitIndexBuilder::newone per object, named by its oid__gunnar_oid__, __gunnar_graph__, __gunnar_reach__
GitIndexBuilder::pack_tierpack-<id>.pack / .idxnone — the pack’s own .idx is the index

with_section — the refs and secrets push logs — works identically on both, because it is the server’s log and has nothing to do with how the objects are laid out. That is the reason both tiers route through this one type instead of growing a second writer.

Structs§

GitIndexBuilder
Accumulates objects and emits the reserved sections.