pub struct Repository { /* private fields */ }Implementations§
Source§impl Repository
impl Repository
Sourcepub fn reset_to_parent(&self) -> Result<()>
pub fn reset_to_parent(&self) -> Result<()>
Performs a soft reset to the parent of HEAD (HEAD~1).
This undoes the last commit while keeping changes staged.
§Errors
Returns an error if:
- HEAD cannot be resolved
- HEAD has no parent (initial commit)
- The reset operation fails
Source§impl Repository
impl Repository
Sourcepub fn changed_files(
&self,
base: Option<&str>,
head: &str,
) -> Result<Vec<FileChange>>
pub fn changed_files( &self, base: Option<&str>, head: &str, ) -> Result<Vec<FileChange>>
§Errors
Returns GitError::RefNotFound if either base or head cannot be resolved.
Sourcepub fn changed_files_from_head(&self, base: &str) -> Result<Vec<FileChange>>
pub fn changed_files_from_head(&self, base: &str) -> Result<Vec<FileChange>>
§Errors
Returns GitError::RefNotFound if the base reference cannot be resolved.
Source§impl Repository
impl Repository
Sourcepub fn delete_file(&self, path: &Path) -> Result<()>
pub fn delete_file(&self, path: &Path) -> Result<()>
§Errors
Returns GitError::FileDelete if the file cannot be deleted.
Sourcepub fn delete_files(&self, paths: &[&Path]) -> Result<()>
pub fn delete_files(&self, paths: &[&Path]) -> Result<()>
§Errors
Returns GitError::FileDelete if any file cannot be deleted.
Source§impl Repository
impl Repository
Source§impl Repository
impl Repository
Source§impl Repository
impl Repository
Sourcepub fn current_branch(&self) -> Result<String>
pub fn current_branch(&self) -> Result<String>
§Errors
Returns GitError::DetachedHead if HEAD is not on a branch.
Sourcepub fn is_working_tree_clean(&self) -> Result<bool>
pub fn is_working_tree_clean(&self) -> Result<bool>
§Errors
Returns an error if the git status operation fails.
Sourcepub fn require_clean_working_tree(&self) -> Result<()>
pub fn require_clean_working_tree(&self) -> Result<()>
§Errors
Returns GitError::DirtyWorkingTree if there are uncommitted changes.
Source§impl Repository
impl Repository
Auto Trait Implementations§
impl Freeze for Repository
impl RefUnwindSafe for Repository
impl Send for Repository
impl !Sync for Repository
impl Unpin for Repository
impl UnsafeUnpin for Repository
impl UnwindSafe for Repository
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