Struct GitWorkingDir

Source
pub struct GitWorkingDir {
    pub working_dir_path: Arc<PathBuf>,
}

Fields§

§working_dir_path: Arc<PathBuf>

Implementations§

Source§

impl GitWorkingDir

Source

pub fn working_dir_path_ref(&self) -> &Path

Source

pub fn working_dir_path_arc(&self) -> Arc<PathBuf>

Source

pub fn git<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], quiet: bool, ) -> Result<bool>

Execute the external “git” command with base_path as its current directory and with the given arguments. Returns true when git exited with code 0, false if 1; returns an error for other exit codes or errors.

Source

pub fn git_stdout<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], ) -> Result<Vec<u8>>

Only succeeds if Git exited with code 0.

Source

pub fn git_stdout_accepting<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], acceptable_status_codes: &[i32], ) -> Result<(bool, Vec<u8>)>

Only succeeds if Git exited with one of the given exit codes, returning truthy, too.

Source

pub fn git_stdout_string_trimmed_accepting<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], acceptable_status_codes: &[i32], ) -> Result<(bool, String)>

Retrieve the output from a Git command as utf-8 decoded string, with leading and trailing whitespace removed.

Source

pub fn git_stdout_string_trimmed<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], ) -> Result<String>

Retrieve the output from a Git command as utf-8 decoded string, with leading and trailing whitespace removed.

Source

pub fn git_stdout_optional_string_trimmed<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], ) -> Result<Option<String>>

Retrieve the output from a Git command as utf-8 decoded string, with leading and trailing whitespace removed; return the empty string as None.

Source

pub fn git_branch_show_current(&self) -> Result<Option<String>>

Get the name of the checked-out branch, if any.

Source

pub fn git_describe<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], ) -> Result<String>

Get the name of the checked-out branch, if any.

Source

pub fn get_head_commit_id(&self) -> Result<String>

Source

pub fn git_ls_files(&self) -> Result<Vec<BaseAndRelPath>>

Source§

impl GitWorkingDir

Source§

impl GitWorkingDir

Source

pub fn git_log<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], ) -> Result<GitLogIterator<ChildStdout, Child>>

Git log will already receive appropriate formatting options (--raw or --format..), don’t give any!

Source

pub fn git_rev_parse( &self, name: &str, to_commit: bool, ) -> Result<Option<String>>

Resolve the given reference. If to_commit is true, resolves to a commit id. Returns None if the reference doesn’t exist / can’t be resolved (details?). Note that it’s not possible to check commit ids for existence, use git_cat_file with GitCatFileMode::ShowExists instead.

Source

pub fn git_tag( &self, tag_name: &str, revision: Option<&str>, message: &str, sign: bool, local_user: Option<&str>, ) -> Result<bool>

Create an annotated or signed Git tag. Returns whether the tag has been created, false means the tag already exists on the same commit (an error is returned if it exists on another commit). Does not check whether the tag message is the same, though!

Source

pub fn git_remote_get_default_for_branch( &self, branch_name: &str, ) -> Result<Option<String>>

Get the name of the remote for the given branch

Source

pub fn git_push<S: AsRef<OsStr> + Debug>( &self, repository: &str, refspecs: &[S], quiet: bool, ) -> Result<()>

Push the given refspecs (like branch or tag names) to the given repository (like remote name).

Source§

impl GitWorkingDir

Source

pub fn git_reset<S: AsRef<OsStr> + Debug>( &self, mode: GitResetMode, options: &[S], refspec: &str, quiet: bool, ) -> Result<()>

Source§

impl GitWorkingDir

Source

pub fn git_cat_file(&self, mode: GitCatFileMode, object: &str) -> Result<bool>

Source

pub fn contains_reference(&self, object: &str) -> Result<bool>

Shortcut for git_cat_file(GitCatFileMode::ShowExists, ..) for easy reach

Trait Implementations§

Source§

impl Clone for GitWorkingDir

Source§

fn clone(&self) -> GitWorkingDir

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GitWorkingDir

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<PathBuf> for GitWorkingDir

Source§

fn from(value: PathBuf) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.