class
Agate::Packbuilder
- Agate::Packbuilder
- Reference
- Object
Overview
Builds packfiles from repository objects.
pb = Packbuilder.new(repo)
pb.insert(commit_oid)
pb.insert_tree(tree_oid)
data = pb.write_buf
pb.object_count # => number of objects packed
Defined in:
agate/pack.crConstructors
-
.new(repo : Repository) : Packbuilder
Creates a new packbuilder for the given repository.
Instance Method Summary
-
#insert(oid : OID, name : String | Nil = nil) : Nil
Inserts a single object by OID.
-
#insert_commit(oid : OID) : Nil
Inserts a commit and its referenced tree.
-
#insert_recur(oid : OID, name : String | Nil = nil) : Nil
Recursively inserts an object and all objects it references.
-
#insert_tree(oid : OID) : Nil
Inserts a tree and all its referenced objects.
-
#insert_walk(walker : Walker) : Nil
Inserts all commits from a revision walker.
-
#name : String | Nil
Returns the unique name for the resulting packfile.
-
#object_count : Int64
Returns the total number of objects to be packed.
-
#set_threads(n : UInt32) : UInt32
Sets the number of threads for delta compression.
-
#write(path : String | Nil = nil, mode : UInt32 = 0) : Nil
Writes the pack and index files to the given directory (or the repository's default pack directory if nil).
-
#write_buf : Bytes
Writes the packfile contents to a buffer and returns it.
-
#written : Int64
Returns the number of objects already written.
Constructor Detail
Creates a new packbuilder for the given repository.
Instance Method Detail
Inserts a single object by OID.
Recursively inserts an object and all objects it references.
Returns the unique name for the resulting packfile.
Only valid after #write or #write_buf.
Sets the number of threads for delta compression. Pass 0 to auto-detect. Returns the actual number of threads.
Writes the pack and index files to the given directory (or the repository's default pack directory if nil).