pub struct GitRepo { /* private fields */ }Implementations§
Source§impl GitRepo
impl GitRepo
Sourcepub fn open(path: &Path) -> Option<Self>
pub fn open(path: &Path) -> Option<Self>
Attempt to open (discover) a git repository at or above path.
Returns None if path is not inside a git repository.
Sourcepub fn branch_name(&self) -> Result<Option<String>>
pub fn branch_name(&self) -> Result<Option<String>>
Returns the current branch name, or None if HEAD is detached.
Sourcepub fn summary(&self) -> Result<GitSummary>
pub fn summary(&self) -> Result<GitSummary>
Returns a high-level summary of the repository state: branch, dirty counts, ahead/behind.
Sourcepub fn is_dirty(&self) -> Result<bool>
pub fn is_dirty(&self) -> Result<bool>
Returns true if the working tree has any uncommitted changes or untracked files.
Sourcepub fn ahead_behind(&self) -> Result<Option<(usize, usize)>>
pub fn ahead_behind(&self) -> Result<Option<(usize, usize)>>
Returns (ahead, behind) counts relative to the upstream tracking branch. Returns None if there’s no tracking branch configured or HEAD is detached.
Sourcepub fn commit_all(&self, message: &str) -> Result<()>
pub fn commit_all(&self, message: &str) -> Result<()>
Stage all changes and create a commit. Errors if there’s nothing to commit.
Sourcepub fn dirty_files(&self) -> Result<Vec<DirtyFile>>
pub fn dirty_files(&self) -> Result<Vec<DirtyFile>>
Returns a list of dirty files with their statuses.
Uses git status --porcelain for reliable results across all repo states.
pub fn push(&self) -> Result<PushResult>
pub fn pull(&self) -> Result<PullResult>
Auto Trait Implementations§
impl !Freeze for GitRepo
impl !RefUnwindSafe for GitRepo
impl !Send for GitRepo
impl !Sync for GitRepo
impl Unpin for GitRepo
impl UnsafeUnpin 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