Struct git2::PackBuilder

source ·
pub struct PackBuilder<'repo> { /* private fields */ }
Expand description

A builder for creating a packfile

Implementations§

Insert a single object. For an optimal pack it’s mandatory to insert objects in recency order, commits followed by trees and blobs.

Insert a root tree object. This will add the tree as well as all referenced trees and blobs.

Insert a commit object. This will add a commit as well as the completed referenced tree.

Insert objects as given by the walk. Those commits and all objects they reference will be inserted into the packbuilder.

Recursively insert an object and its referenced objects. Insert the object as well as any object it references.

Write the contents of the packfile to an in-memory buffer. The contents of the buffer will become a valid packfile, even though there will be no attached index.

Create the new pack and pass each object to the callback.

progress will be called with progress information during pack building. Be aware that this is called inline with pack building operations, so performance may be affected.

There can only be one progress callback attached, this will replace any existing one. See unset_progress_callback to remove the current progress callback without attaching a new one.

Remove the current progress callback. See set_progress_callback to set the progress callback.

Set the number of threads to be used.

Returns the number of threads to be used.

Get the total number of objects the packbuilder will write out.

Get the number of objects the packbuilder has already written out.

👎Deprecated: use name() to retrieve the filename

Get the packfile’s hash. A packfile’s name is derived from the sorted hashing of all object names. This is only correct after the packfile has been written.

Get the unique name for the resulting packfile.

The packfile’s name is derived from the packfile’s content. This is only correct after the packfile has been written.

Returns None if the packfile has not been written or if the name is not valid utf-8.

Get the unique name for the resulting packfile, in bytes.

The packfile’s name is derived from the packfile’s content. This is only correct after the packfile has been written.

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.