Struct branchless::testing::Git[][src]

pub struct Git<'a> {
    pub repo_path: &'a Path,
    pub git_executable: &'a Path,
}

Wrapper around the Git executable, for testing.

Fields

repo_path: &'a Path

The path to the repository on disk. The directory itself must exist, although it might not have a .git folder in it. (Use Git::init_repo to initialize it.)

git_executable: &'a Path

The path to the Git executable on disk. This is important since we test against multiple Git versions.

Implementations

impl<'a> Git<'a>[src]

pub fn new(repo_path: &'a Path, git_executable: &'a GitExecutable<'_>) -> Self[src]

Constructor.

pub fn preprocess_stdout(&self, stdout: String) -> Result<String>[src]

Replace dynamic strings in the output, for testing purposes.

pub fn get_path_for_env(&self) -> String[src]

Get the PATH environment variable to use for testing.

pub fn run_with_options<S: AsRef<str> + Debug>(
    &self,
    args: &[S],
    options: &GitRunOptions
) -> Result<(String, String)>
[src]

Run a Git command.

pub fn run<S: AsRef<str> + Debug>(&self, args: &[S]) -> Result<(String, String)>[src]

Run a Git command.

pub fn init_repo_with_options(&self, options: &GitInitOptions) -> Result<()>[src]

Set up a Git repo in the directory and initialize git-branchless to work with it.

pub fn init_repo(&self) -> Result<()>[src]

Set up a Git repo in the directory and initialize git-branchless to work with it.

pub fn commit_file_with_contents(
    &self,
    name: &str,
    time: isize,
    contents: &str
) -> Result<Oid>
[src]

Commit a file with default contents. The time argument is used to set the commit timestamp, which is factored into the commit hash.

pub fn commit_file(&self, name: &str, time: isize) -> Result<Oid>[src]

Commit a file with default contents. The time argument is used to set the commit timestamp, which is factored into the commit hash.

pub fn detach_head(&self) -> Result<()>[src]

Detach HEAD. This is useful to call to make sure that no branch is checked out, and therefore that future commit operations don’t move any branches.

pub fn get_repo(&self) -> Result<Repository>[src]

Get a git2::Repository object for this repository.

pub fn get_version(&self) -> Result<GitVersion>[src]

Get the version of the Git executable.

pub fn supports_reference_transactions(&self) -> Result<bool>[src]

Determine if the Git executable supports the reference-transaction hook.

pub fn resolve_file(&self, name: &str, contents: &str) -> Result<()>[src]

Resolve a file during a merge or rebase conflict with the provided contents.

Trait Implementations

impl<'a> Debug for Git<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Git<'a>

impl<'a> Send for Git<'a>

impl<'a> Sync for Git<'a>

impl<'a> Unpin for Git<'a>

impl<'a> UnwindSafe for Git<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> With for T