Struct git2::build::TreeUpdateBuilder
source · pub struct TreeUpdateBuilder { /* private fields */ }
Expand description
A builder struct for git tree updates.
Paths passed to remove
and upsert
can be multi-component paths, i.e. they
may contain slashes.
This is a higher-level tree update facility. There is also TreeBuilder
which is lower-level (and operates only on one level of the tree at a time).
Implementations§
source§impl TreeUpdateBuilder
impl TreeUpdateBuilder
sourcepub fn remove<T: IntoCString>(&mut self, path: T) -> &mut Self
pub fn remove<T: IntoCString>(&mut self, path: T) -> &mut Self
Add an update removing the specified path
from a tree.
sourcepub fn upsert<T: IntoCString>(
&mut self,
path: T,
id: Oid,
filemode: FileMode,
) -> &mut Self
pub fn upsert<T: IntoCString>( &mut self, path: T, id: Oid, filemode: FileMode, ) -> &mut Self
Add an update setting the specified path
to a specific Oid, whether it currently exists
or not.
Note that libgit2 does not support an upsert of a previously removed path, or an upsert that changes the type of an object (such as from tree to blob or vice versa).
sourcepub fn create_updated(
&mut self,
repo: &Repository,
baseline: &Tree<'_>,
) -> Result<Oid, Error>
pub fn create_updated( &mut self, repo: &Repository, baseline: &Tree<'_>, ) -> Result<Oid, Error>
Create a new tree from the specified baseline and this series of updates.
The baseline tree must exist in the specified repository.
Trait Implementations§
source§impl Default for TreeUpdateBuilder
impl Default for TreeUpdateBuilder
impl Send for TreeUpdateBuilder
Auto Trait Implementations§
impl Freeze for TreeUpdateBuilder
impl RefUnwindSafe for TreeUpdateBuilder
impl !Sync for TreeUpdateBuilder
impl Unpin for TreeUpdateBuilder
impl UnwindSafe for TreeUpdateBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more