pub struct GitWorkArea { /* private fields */ }
Expand description

A representation of an empty workarea where actions which require a work tree and an index may be preformed.

Implementations§

source§

impl GitWorkArea

source

pub fn new(context: GitContext, rev: &CommitId) -> Result<Self, WorkAreaError>

Create an area for performing actions which require a work tree.

source

pub fn git(&self) -> Command

Run a git command in the workarea.

source

pub fn checkout<I, P>(&mut self, paths: I) -> Result<(), GitError>where I: IntoIterator<Item = P>, P: AsRef<OsStr>,

Checkout paths from the index to the filesystem.

Normally, files are not placed into the worktree, so checks which use other tools to inspect file contents do not work. This method checks out files to the working directory and fixes up Git’s knowledge that they are there.

All paths supported by Git’s globbing and searching mechanisms are supported.

source

pub fn setup_merge<'a>( &'a self, bases: &[CommitId], base: &CommitId, topic: &CommitId ) -> Result<MergeResult<'a>, GitError>

Prepare a command to create a merge commit.

The merge is performed, but only as a tree object. In order to create the actual commit object, a successful merge returns a command which should be executed to create the commit object. That commit object should then be stored in a reference using git update-ref.

source

pub fn setup_update_merge<'a>( &'a self, base: &CommitId, topic: &CommitId ) -> Result<MergeResult<'a>, GitError>

Prepare a command to create a merge commit.

The merge is performed, but only as a tree object. In order to create the actual commit object, a successful merge returns a command which should be executed to create the commit object. That commit object should then be stored in a reference using git update-ref.

source

pub fn cd_to_work_tree<'a>(&self, cmd: &'a mut Command) -> &'a mut Command

Run a command from the work tree root.

source

pub fn gitdir(&self) -> &Path

The path to the git repository.

source

pub fn submodule_config(&self) -> &SubmoduleConfig

The submodule configuration for the repository.

This is read from the .gitmodules file in the commit (if it exists).

Trait Implementations§

source§

impl Debug for GitWorkArea

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.