Struct git2::TreeBuilder
[−]
[src]
pub struct TreeBuilder<'repo> { // some fields omitted }
Constructor for in-memory trees
Methods
impl<'repo> TreeBuilder<'repo>
[src]
fn clear(&mut self)
Clear all the entries in the builder
fn len(&self) -> usize
Get the number of entries
fn get<P>(&self, filename: P) -> Result<Option<TreeEntry>, Error> where P: IntoCString
Get en entry from the builder from its filename
fn insert<P: IntoCString>(&mut self, filename: P, oid: Oid, filemode: i32) -> Result<TreeEntry, Error>
Add or update an entry in the builder
No attempt is made to ensure that the provided Oid points to an object of a reasonable type (or any object at all).
The mode given must be one of 0o040000, 0o100644, 0o100755, 0o120000 or 0o160000 currently.
fn remove<P: IntoCString>(&mut self, filename: P) -> Result<(), Error>
Remove an entry from the builder by its filename
fn filter<F>(&mut self, filter: F) where F: FnMut(&TreeEntry) -> bool
Selectively remove entries from the tree
Values for which the filter returns true
will be kept. Note
that this behavior is different from the libgit2 C interface.
fn write(&self) -> Result<Oid, Error>
Write the contents of the TreeBuilder as a Tree object and return its Oid