git.pack.pack_stream

git.pack

pack_stream(git_dir, objects, tick) -> stream, err

Open a version 2 packfile of the given objects, to be read a record at a time

Takes the records collect_objects returns, each id once, and locates every object before it returns: a missing one fails here, with no byte handed out. tick, when given, is called once every 32 objects it locates.

stream:next() returns the next piece of the pack: the 12-byte header, then one entry per call, then the 20-byte SHA-1 trailer, then nil. The entries go out in the order the repository holds them: loose objects first, then each pack's by offset. A packed entry's stored stream is copied, and a packed delta as a REF_DELTA when its base went out before it. Every other object is read and deflated. A fault on the way, such as an object gone since the stream opened, returns nil and the reason, at that call and every later one.