Struct branchless::testing::Git [−][src]
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]
&self,
args: &[S],
options: &GitRunOptions
) -> Result<(String, String)>
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]
&self,
name: &str,
time: isize,
contents: &str
) -> Result<Oid>
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[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]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> With for T
pub fn wrap_with<U, F>(self, f: F) -> U where
F: FnOnce(Self) -> U,
F: FnOnce(Self) -> U,
pub fn with<F>(self, f: F) -> Self where
F: FnOnce(&mut Self),
F: FnOnce(&mut Self),
pub fn try_with<E, F>(self, f: F) -> Result<Self, E> where
F: FnOnce(&mut Self) -> Result<(), E>,
F: FnOnce(&mut Self) -> Result<(), E>,
pub fn with_if<F>(self, condition: bool, f: F) -> Self where
F: FnOnce(&mut Self),
F: FnOnce(&mut Self),