git.pack

index · git

Overview

Packfile generation on top of the git core reader: walk the object graph from a set of wanted refs and serialize a version 2 packfile.

Objects are stored undeltified (each entry is just the zlib-compressed raw object), so generated packs are larger than git's own but valid for any client. The pack is assembled in memory — peak use is roughly the compressed pack size.

Functions

NameSignature
collect_objectscollect_objects(git_dir, wants) -> objects, err
build_packbuild_pack(git_dir, objects) -> pack, err

collect_objects(git_dir, wants) -> objects, err

Collect all objects reachable from the given commit/tag SHAs

Walks commits (parents + trees), trees (entries, skipping gitlinks), and annotated tags. Returns an array of { sha = hex, type = str }.

build_pack(git_dir, objects) -> pack, err

Build a version 2 packfile containing the given objects, undeltified