pub struct GitCli { /* private fields */ }
Expand description
Support for source control operations through running Git commands.
This assumes that the underlying Git repository doesn’t change in the middle of an operation, and caches data as a result. If mutation operations are added, the caches would need to be invalidated.
Implementations§
Source§impl GitCli
impl GitCli
Sourcepub fn tracked_files(&self) -> Result<&Utf8Paths0>
pub fn tracked_files(&self) -> Result<&Utf8Paths0>
Returns the files tracked by Git in this working copy.
The return value can be iterated on to get a list of paths.
Sourcepub fn merge_base(&self, commit_ref: &str) -> Result<GitHash>
pub fn merge_base(&self, commit_ref: &str) -> Result<GitHash>
Returns the merge base of the current commit (HEAD
) with the specified commit.
Sourcepub fn files_changed_between<'a>(
&self,
old: impl Into<Cow<'a, OsStr>>,
new: impl Into<Option<Cow<'a, OsStr>>>,
diff_filter: Option<&str>,
) -> Result<Utf8Paths0>
pub fn files_changed_between<'a>( &self, old: impl Into<Cow<'a, OsStr>>, new: impl Into<Option<Cow<'a, OsStr>>>, diff_filter: Option<&str>, ) -> Result<Utf8Paths0>
Returns the files changed between the given commits, or the current directory if the new commit isn’t specified.
For more about the diff filter, see man git-diff
’s help for --diff-filter
.
Sourcepub fn package_graph_at(&self, commit_ref: &GitHash) -> Result<PackageGraph>
pub fn package_graph_at(&self, commit_ref: &GitHash) -> Result<PackageGraph>
Returns a package graph for the given commit, using a scratch repo if necessary.
pub fn is_git_repo(&self, dir: &Utf8Path) -> Result<bool>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GitCli
impl RefUnwindSafe for GitCli
impl Send for GitCli
impl Sync for GitCli
impl Unpin for GitCli
impl UnwindSafe for GitCli
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
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>
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 more