Expand description
Packfile reading (pack v2 + index v2), the normal post-gc/clone storage.
A .idx (version 2) maps object hashes to byte offsets in the sibling
.pack; each pack object is a varint-headed, zlib-compressed blob that may be
whole (commit/tree/blob/tag) or a delta (OFS_DELTA/REF_DELTA) against
another object. This module resolves deltas recursively and verifies the
SHA-1 of every reconstructed object.
Reference: git Documentation/gitformat-pack.txt (pack + index v2 layouts,
delta instruction encoding).
Functions§
- apply_
delta - Apply a git delta (
base+ delta instructions → reconstructed object). - list_
packed - Enumerate every object SHA across all packfiles under
objects_dir. - read_
packed - Read
hashfrom any packfile underobjects_dir. ReturnsOk(None)when no pack contains it (so the caller can report a genuine not-found).