pub struct GitWorkingDir {
pub working_dir_path: Arc<PathBuf>,
}Fields§
§working_dir_path: Arc<PathBuf>Implementations§
Source§impl GitWorkingDir
impl GitWorkingDir
pub fn working_dir_path_ref(&self) -> &Path
pub fn working_dir_path_arc(&self) -> Arc<PathBuf>
Sourcepub fn git<S: AsRef<OsStr> + Debug>(
&self,
arguments: &[S],
quiet: bool,
) -> Result<bool>
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.
Sourcepub fn git_stdout<S: AsRef<OsStr> + Debug>(
&self,
arguments: &[S],
) -> Result<Vec<u8>>
pub fn git_stdout<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], ) -> Result<Vec<u8>>
Only succeeds if Git exited with code 0.
Sourcepub fn git_stdout_accepting<S: AsRef<OsStr> + Debug>(
&self,
arguments: &[S],
acceptable_status_codes: &[i32],
) -> Result<(bool, Vec<u8>)>
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.
Sourcepub fn git_stdout_string_trimmed_accepting<S: AsRef<OsStr> + Debug>(
&self,
arguments: &[S],
acceptable_status_codes: &[i32],
) -> Result<(bool, String)>
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.
Sourcepub fn git_stdout_string_trimmed<S: AsRef<OsStr> + Debug>(
&self,
arguments: &[S],
) -> Result<String>
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.
Sourcepub fn git_stdout_optional_string_trimmed<S: AsRef<OsStr> + Debug>(
&self,
arguments: &[S],
) -> Result<Option<String>>
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.
Sourcepub fn git_branch_show_current(&self) -> Result<Option<String>>
pub fn git_branch_show_current(&self) -> Result<Option<String>>
Get the name of the checked-out branch, if any.
Sourcepub fn git_describe<S: AsRef<OsStr> + Debug>(
&self,
arguments: &[S],
) -> Result<String>
pub fn git_describe<S: AsRef<OsStr> + Debug>( &self, arguments: &[S], ) -> Result<String>
Get the name of the checked-out branch, if any.
pub fn get_head_commit_id(&self) -> Result<String>
pub fn git_ls_files(&self) -> Result<Vec<BaseAndRelPath>>
Source§impl GitWorkingDir
impl GitWorkingDir
pub fn git_status(&self) -> Result<Vec<GitStatusItem>>
Source§impl GitWorkingDir
impl GitWorkingDir
Sourcepub fn git_log<S: AsRef<OsStr> + Debug>(
&self,
arguments: &[S],
) -> Result<GitLogIterator<ChildStdout, Child>>
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!
Sourcepub fn git_rev_parse(
&self,
name: &str,
to_commit: bool,
) -> Result<Option<String>>
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.
Sourcepub fn git_tag(
&self,
tag_name: &str,
revision: Option<&str>,
message: &str,
sign: bool,
local_user: Option<&str>,
) -> Result<bool>
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§impl GitWorkingDir
impl GitWorkingDir
Source§impl GitWorkingDir
impl GitWorkingDir
pub fn git_cat_file(&self, mode: GitCatFileMode, object: &str) -> Result<bool>
Sourcepub fn contains_reference(&self, object: &str) -> Result<bool>
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
impl Clone for GitWorkingDir
Source§fn clone(&self) -> GitWorkingDir
fn clone(&self) -> GitWorkingDir
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more