Trait project2::repository::GitRepository
source · pub trait GitRepository: Send {
// Required methods
fn reload_index(&self);
fn load_index_text(&self, relative_file_path: &Path) -> Option<String>;
fn branch_name(&self) -> Option<String>;
fn staged_statuses(
&self,
path_prefix: &Path
) -> TreeMap<RepoPath, GitFileStatus>;
fn unstaged_status(
&self,
path: &RepoPath,
mtime: SystemTime
) -> Option<GitFileStatus>;
fn status(
&self,
path: &RepoPath,
mtime: SystemTime
) -> Option<GitFileStatus>;
fn branches(&self) -> Result<Vec<Branch, Global>, Error>;
fn change_branch(&self, _: &str) -> Result<(), Error>;
fn create_branch(&self, _: &str) -> Result<(), Error>;
}
Required Methods§
fn reload_index(&self)
fn load_index_text(&self, relative_file_path: &Path) -> Option<String>
fn branch_name(&self) -> Option<String>
sourcefn staged_statuses(
&self,
path_prefix: &Path
) -> TreeMap<RepoPath, GitFileStatus>
fn staged_statuses( &self, path_prefix: &Path ) -> TreeMap<RepoPath, GitFileStatus>
Get the statuses of all of the files in the index that start with the given path and have changes with resepect to the HEAD commit. This is fast because the index stores hashes of trees, so that unchanged directories can be skipped.
sourcefn unstaged_status(
&self,
path: &RepoPath,
mtime: SystemTime
) -> Option<GitFileStatus>
fn unstaged_status( &self, path: &RepoPath, mtime: SystemTime ) -> Option<GitFileStatus>
Get the status of a given file in the working directory with respect to the index. In the common case, when there are no changes, this only requires an index lookup. The index stores the mtime of each file when it was added, so there’s no work to do if the mtime matches.
sourcefn status(&self, path: &RepoPath, mtime: SystemTime) -> Option<GitFileStatus>
fn status(&self, path: &RepoPath, mtime: SystemTime) -> Option<GitFileStatus>
Get the status of a given file in the working directory with respect to the HEAD commit. In the common case, when there are no changes, this only requires an index lookup and blob comparison between the index and the HEAD commit. The index stores the mtime of each file when it was added, so there’s no need to consider the working directory file if the mtime matches.