class Agate::Packbuilder

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.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(repo : Repository) : Packbuilder #

Creates a new packbuilder for the given repository.


[View source]

Instance Method Detail

def insert(oid : OID, name : String | Nil = nil) : Nil #

Inserts a single object by OID.


[View source]
def insert_commit(oid : OID) : Nil #

Inserts a commit and its referenced tree.


[View source]
def insert_recur(oid : OID, name : String | Nil = nil) : Nil #

Recursively inserts an object and all objects it references.


[View source]
def insert_tree(oid : OID) : Nil #

Inserts a tree and all its referenced objects.


[View source]
def insert_walk(walker : Walker) : Nil #

Inserts all commits from a revision walker.


[View source]
def name : String | Nil #

Returns the unique name for the resulting packfile. Only valid after #write or #write_buf.


[View source]
def object_count : Int64 #

Returns the total number of objects to be packed.


[View source]
def set_threads(n : UInt32) : UInt32 #

Sets the number of threads for delta compression. Pass 0 to auto-detect. Returns the actual number of threads.


[View source]
def 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).


[View source]
def write_buf : Bytes #

Writes the packfile contents to a buffer and returns it.


[View source]
def written : Int64 #

Returns the number of objects already written.


[View source]