pub struct FakeGit { /* private fields */ }Expand description
A small stateful Git model. It keeps working-tree, index, and committed snapshots separate so staging and discarding have observable semantics.
Implementations§
Source§impl FakeGit
impl FakeGit
pub fn new(root: impl Into<PathBuf>) -> Self
pub fn not_a_repository(root: impl Into<PathBuf>) -> Self
pub fn set_repository_available(&mut self, available: bool)
pub fn root(&self) -> PathBuf
pub fn add_file(&mut self, path: impl Into<String>, contents: impl AsRef<[u8]>)
pub fn write_file( &mut self, path: impl Into<String>, contents: impl AsRef<[u8]>, )
pub fn remove_file(&mut self, path: &str)
pub fn stage(&mut self, path: &str) -> bool
pub fn unstage(&mut self, path: &str) -> bool
pub fn stage_all(&mut self)
pub fn unstage_all(&mut self)
pub fn discard(&mut self, path: &str) -> bool
pub fn commit(&mut self, message: impl Into<String>) -> Result<(), GitDiffError>
pub fn file(&self, path: &str) -> Option<FakeGitFile>
pub fn files(&self) -> Vec<FakeGitFile>
pub fn commits(&self) -> Vec<String>
pub fn status(&self, path: &str) -> Option<(FileStatus, StageState)>
pub fn apply(&mut self, action: RepositoryAction) -> Result<(), GitDiffError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FakeGit
impl RefUnwindSafe for FakeGit
impl Send for FakeGit
impl Sync for FakeGit
impl Unpin for FakeGit
impl UnsafeUnpin for FakeGit
impl UnwindSafe for FakeGit
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.