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

source

pub fn new() -> Self

Create a new empty series of updates.

source

pub fn remove<T: IntoCString>(&mut self, path: T) -> &mut Self

Add an update removing the specified path from a tree.

source

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

source

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

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Send for TreeUpdateBuilder

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.