pub struct GitRepo { /* private fields */ }Expand description
A git repository wrapper for parsing commits
Implementations§
Source§impl GitRepo
impl GitRepo
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, GitError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, GitError>
Open a git repository at the given path
§Errors
Returns GitError::RepositoryNotFound if the path is not a git repository.
Sourcepub fn discover(path: impl AsRef<Path>) -> Result<Self, GitError>
pub fn discover(path: impl AsRef<Path>) -> Result<Self, GitError>
Discover and open a git repository containing the given path
This walks up the directory tree to find a .git directory.
§Errors
Returns GitError::RepositoryNotFound if no repository is found.
Sourcepub fn walk_commits(
&self,
options: &WalkOptions,
) -> Result<Vec<CommitWithDiff>, GitError>
pub fn walk_commits( &self, options: &WalkOptions, ) -> Result<Vec<CommitWithDiff>, GitError>
Walk commits according to the given options
§Errors
Returns GitError if the repository cannot be walked.
Sourcepub fn get_commit(&self, reference: &str) -> Result<CommitWithDiff, GitError>
pub fn get_commit(&self, reference: &str) -> Result<CommitWithDiff, GitError>
Get a single commit by SHA or reference
§Errors
Returns GitError::InvalidReference if the reference cannot be resolved.
Auto Trait Implementations§
impl Freeze for GitRepo
impl RefUnwindSafe for GitRepo
impl Send for GitRepo
impl !Sync for GitRepo
impl Unpin for GitRepo
impl UnwindSafe for GitRepo
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