pub struct Repository { /* private fields */ }
Expand description
The main repository object.
This wrapper allows to keep track of optional git-dir and work-tree directories when
executing commands. This functionality was needed for glv
& git-stree
project.
Implementations§
Source§impl Repository
Getters
impl Repository
Getters
Sourcepub fn is_shallow(&self) -> bool
pub fn is_shallow(&self) -> bool
§Panics
Panics of executing git-rev-parse(1) fails
Sourcepub fn work_tree(&self) -> Option<PathBuf>
pub fn work_tree(&self) -> Option<PathBuf>
Return path to git WORK_TREE
TODO move to generic repo trait TODO Remove optional
Sourcepub fn short_ref(&self, long_ref: &str) -> Result<String, InvalidRefError>
pub fn short_ref(&self, long_ref: &str) -> Result<String, InvalidRefError>
§Errors
Will return InvalidRefError
if invalid reference provided
Source§impl Repository
Constructors
impl Repository
Constructors
Source§impl Repository
Functions
impl Repository
Functions
Sourcepub fn commit(&self, message: &str) -> Result<(), CommitError>
pub fn commit(&self, message: &str) -> Result<(), CommitError>
Return config value for specified key
§Errors
See CommitError
§Panics
When git-commit(1)
fails to execute
Sourcepub fn commit_extended(
&self,
message: &str,
allow_empty: bool,
no_verify: bool,
) -> Result<(), CommitError>
pub fn commit_extended( &self, message: &str, allow_empty: bool, no_verify: bool, ) -> Result<(), CommitError>
§Errors
See CommitError
Sourcepub fn hack_read_file(&self, path: &Path) -> Result<Vec<u8>>
pub fn hack_read_file(&self, path: &Path) -> Result<Vec<u8>>
Read file from workspace or use git-show(1)
if bare repository
§Panics
When UTF-8 encoding path fails
§Errors
When fails throws std::io::Error
TODO move to generic repo trait
Sourcepub fn is_ancestor(&self, first: &str, second: &str) -> bool
pub fn is_ancestor(&self, first: &str, second: &str) -> bool
Returns true if the first
commit is an ancestor of the second
commit.
Sourcepub fn remote_ref_to_id(
&self,
remote: &str,
git_ref: &str,
) -> Result<String, RefSearchError>
pub fn remote_ref_to_id( &self, remote: &str, git_ref: &str, ) -> Result<String, RefSearchError>
§Errors
See RefSearchError
Sourcepub fn stash_almost_all(&self, message: &str) -> Result<(), StashingError>
pub fn stash_almost_all(&self, message: &str) -> Result<(), StashingError>
Sourcepub fn stash_pop(&self) -> Result<(), StashingError>
pub fn stash_pop(&self) -> Result<(), StashingError>
Sourcepub fn subtree_add(
&self,
url: &str,
prefix: &str,
revision: &str,
message: &str,
) -> Result<(), SubtreeAddError>
pub fn subtree_add( &self, url: &str, prefix: &str, revision: &str, message: &str, ) -> Result<(), SubtreeAddError>
Sourcepub fn subtree_split(&self, prefix: &str) -> Result<(), SubtreeSplitError>
pub fn subtree_split(&self, prefix: &str) -> Result<(), SubtreeSplitError>
Sourcepub fn subtree_pull(
&self,
remote: &str,
prefix: &str,
git_ref: &str,
message: &str,
) -> Result<(), SubtreePullError>
pub fn subtree_pull( &self, remote: &str, prefix: &str, git_ref: &str, message: &str, ) -> Result<(), SubtreePullError>
Sourcepub fn subtree_push(
&self,
remote: &str,
prefix: &str,
git_ref: &str,
) -> Result<(), SubtreePushError>
pub fn subtree_push( &self, remote: &str, prefix: &str, git_ref: &str, ) -> Result<(), SubtreePushError>
§Errors
Fails if current repo is bare. In other error cases see the provided message string.
Source§impl Repository
Commit Functions
impl Repository
Commit Functions
Sourcepub fn merge_base(
&self,
ids: &[&str],
) -> Result<Option<String>, InvalidCommitishError>
pub fn merge_base( &self, ids: &[&str], ) -> Result<Option<String>, InvalidCommitishError>
Trait Implementations§
Source§impl Clone for Repository
impl Clone for Repository
Source§fn clone(&self) -> Repository
fn clone(&self) -> Repository
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more