pub struct Commit<'repo> { /* private fields */ }Expand description
A singular git commit for the repository being inspected
Implementations§
Source§impl<'repo> Commit<'repo>
impl<'repo> Commit<'repo>
Sourcepub fn new(commit: Commit<'repo>, repository: &'repo Repository) -> Self
pub fn new(commit: Commit<'repo>, repository: &'repo Repository) -> Self
Instantiate a new Commit object from a git2 commit
Return the commit author
Return the co-authors as listed in the commit message
Lazilly returning as an iterator means the co-authors, if entered more than once, will not be de-duplicated.
Sourcepub fn branches(
&self,
) -> Result<impl Iterator<Item = Result<String, Error>>, Error>
pub fn branches( &self, ) -> Result<impl Iterator<Item = Result<String, Error>>, Error>
Iterate all utf-8 branch names that the current commit is contained in
§Note
Potentially expensive method. Take caution when using within a loop.
Sourcepub fn local_branches(
&self,
) -> Result<impl Iterator<Item = Result<String, Error>>, Error>
pub fn local_branches( &self, ) -> Result<impl Iterator<Item = Result<String, Error>>, Error>
Iterate all local utf-8 branch names that the current commit is contained in
§Note
Potentially expensive method. Take caution when using within a loop.
Sourcepub fn remote_branches(
&self,
) -> Result<impl Iterator<Item = Result<String, Error>>, Error>
pub fn remote_branches( &self, ) -> Result<impl Iterator<Item = Result<String, Error>>, Error>
Iterate all remote utf-8 branch names that the current commit is contained in
§Note
Potentially expensive method. Take caution when using within a loop.
Sourcepub fn in_main(&self) -> Result<bool, Error>
pub fn in_main(&self) -> Result<bool, Error>
Checks if the current commit is reachable from “main” or “master”
Sourcepub fn mod_files(&self) -> Result<impl Iterator<Item = ModifiedFile<'_>>, Error>
pub fn mod_files(&self) -> Result<impl Iterator<Item = ModifiedFile<'_>>, Error>
Return an iterator over the modified files that belong to a commit
Sourcepub fn insertions(&self) -> Result<usize, Error>
pub fn insertions(&self) -> Result<usize, Error>
The number of insertions in the commit