pub struct Repo { /* private fields */ }Expand description
One git work tree, asked what it would clean.
Implementations§
Source§impl Repo
impl Repo
Sourcepub fn discover(from: &Path) -> Result<Self, RepoError>
pub fn discover(from: &Path) -> Result<Self, RepoError>
Finds the work tree containing from and returns it.
The whole checkout, never a subdirectory of one, even when from is one. git clean
scoped to a subdirectory cleans only that subtree while git reset --hard resets the
entire work tree regardless, so a run rooted at a subdirectory would mean two different
things by “here” in the same breath. Repo mode is the mode for cleaning a checkout, so
it takes the checkout.
§Errors
If git cannot be run, or from is not inside a work tree.
Sourcepub fn enumerate(&self) -> Result<Enumeration, RepoError>
pub fn enumerate(&self) -> Result<Enumeration, RepoError>
Asks git what it would remove.
Two invocations, because the point is to offer the two lists separately: -d for
untracked and -d -X for ignored.
§Errors
If git cannot be run, refuses, or prints something this cannot read.
Sourcepub fn reset(&self, reset: Reset) -> Result<(), RepoError>
pub fn reset(&self, reset: Reset) -> Result<(), RepoError>
Discards tracked changes.
Runs before any removal, because restoring a file the deleter is about to walk past is the one ordering here that has a consequence.
§Errors
If git cannot be run or refuses — an unborn HEAD is the ordinary way to reach the
second, and a run that could not reset has not done what it said it would.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Repo
impl RefUnwindSafe for Repo
impl Send for Repo
impl Sync for Repo
impl Unpin for Repo
impl UnsafeUnpin for Repo
impl UnwindSafe for Repo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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 more