pub struct GitRepository { /* private fields */ }Expand description
Git repository wrapper providing common operations
Implementations§
Source§impl GitRepository
impl GitRepository
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open a git repository from the given path (searches upward for .git)
Sourcepub fn head_commit(&self) -> Result<String>
pub fn head_commit(&self) -> Result<String>
Get the current HEAD commit SHA (full 40-character hex)
Sourcepub fn head_commit_short(&self) -> Result<String>
pub fn head_commit_short(&self) -> Result<String>
Get the short HEAD commit SHA (7 characters)
Sourcepub fn current_branch(&self) -> Result<Option<String>>
pub fn current_branch(&self) -> Result<Option<String>>
Get the current branch name (None if detached HEAD)
Sourcepub fn remote_url(&self, name: &str) -> Result<Option<String>>
pub fn remote_url(&self, name: &str) -> Result<Option<String>>
Get the URL of a remote (e.g., “origin”)
Sourcepub fn is_tracked(&self, path: &Path) -> bool
pub fn is_tracked(&self, path: &Path) -> bool
Check if a file path is tracked by git
Sourcepub fn file_status(&self, path: &Path) -> Result<FileStatus>
pub fn file_status(&self, path: &Path) -> Result<FileStatus>
Get the status of a file
Sourcepub fn modified_files(&self) -> Result<Vec<String>>
pub fn modified_files(&self) -> Result<Vec<String>>
Get list of modified files in the repository
Auto Trait Implementations§
impl Freeze for GitRepository
impl RefUnwindSafe for GitRepository
impl Send for GitRepository
impl !Sync for GitRepository
impl Unpin for GitRepository
impl UnwindSafe for GitRepository
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> 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 more