pub struct GitCommand { /* private fields */ }Expand description
The repository read by running git.
Implementations§
Source§impl GitCommand
impl GitCommand
Sourcepub fn from_command(command: impl Fn() -> Command + 'static) -> Self
pub fn from_command(command: impl Fn() -> Command + 'static) -> Self
Runs the git command that command starts, with the arguments of each call added.
Sourcepub fn prefix(&self, root: &Path) -> Result<String, StoreError>
pub fn prefix(&self, root: &Path) -> Result<String, StoreError>
The working directory’s path from the repository’s top level.
§Errors
root is not inside a repository, or git fails or cannot be run.
Sourcepub fn branch(&self, root: &Path) -> Result<Option<String>, StoreError>
pub fn branch(&self, root: &Path) -> Result<Option<String>, StoreError>
The current branch’s short name, or none on a detached HEAD.
§Errors
root is not inside a repository, or git fails or cannot be run.
Sourcepub fn config_get(
&self,
root: &Path,
name: &str,
) -> Result<Option<String>, StoreError>
pub fn config_get( &self, root: &Path, name: &str, ) -> Result<Option<String>, StoreError>
A name’s value in the local configuration of the repository that holds root, or none.
§Errors
git fails or cannot be run.
Sourcepub fn launcher_version(
&self,
root: &Path,
command: &str,
) -> Result<Option<String>, StoreError>
pub fn launcher_version( &self, root: &Path, command: &str, ) -> Result<Option<String>, StoreError>
The first line <command> --version prints when git runs it as it runs a merge driver:
through the shell, from the top of the working tree; none when it fails.
§Errors
git cannot be run.
Sourcepub fn config_set(
&self,
root: &Path,
name: &str,
value: &str,
) -> Result<(), StoreError>
pub fn config_set( &self, root: &Path, name: &str, value: &str, ) -> Result<(), StoreError>
Sets a name in the local configuration of the repository that holds root.
§Errors
git fails or cannot be run.