pub struct Git { /* private fields */ }Expand description
Git subprocess wrapper.
Implementations§
Source§impl Git
impl Git
Sourcepub fn with_work_dir<P: AsRef<Path>>(path: P) -> Self
pub fn with_work_dir<P: AsRef<Path>>(path: P) -> Self
Create a new Git instance with a specific working directory.
Sourcepub fn check_repository(&self) -> Result<(), Error>
pub fn check_repository(&self) -> Result<(), Error>
Check if we’re in a git repository.
§Errors
Returns an error if git is not found or we’re not in a repository.
Sourcepub fn run(&self, args: &[&str]) -> Result<Output, Error>
pub fn run(&self, args: &[&str]) -> Result<Output, Error>
Run a git command and return the raw output.
§Errors
Returns an error if the command fails to execute.
Sourcepub fn run_output(&self, args: &[&str]) -> Result<String, Error>
pub fn run_output(&self, args: &[&str]) -> Result<String, Error>
Run a git command and return stdout as a string.
§Errors
Returns an error if the command fails or returns non-zero exit code.
Sourcepub fn run_silent(&self, args: &[&str]) -> Result<(), Error>
pub fn run_silent(&self, args: &[&str]) -> Result<(), Error>
Run a git command silently, only checking for success.
§Errors
Returns an error if the command fails.
Sourcepub fn config_unset(&self, key: &str, all: bool) -> Result<(), Error>
pub fn config_unset(&self, key: &str, all: bool) -> Result<(), Error>
Unset a git config value.
If all is true, removes all values for multi-valued keys.
§Errors
Returns an error if the config cannot be unset.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Git
impl RefUnwindSafe for Git
impl Send for Git
impl Sync for Git
impl Unpin for Git
impl UnwindSafe for Git
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