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§

source

fn reload_index(&self)

source

fn load_index_text(&self, relative_file_path: &Path) -> Option<String>

source

fn branch_name(&self) -> Option<String>

source

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.

source

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.

source

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.

source

fn branches(&self) -> Result<Vec<Branch, Global>, Error>

source

fn change_branch(&self, _: &str) -> Result<(), Error>

source

fn create_branch(&self, _: &str) -> Result<(), Error>

Trait Implementations§

source§

impl Debug for dyn GitRepository

source§

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

Formats the value using the given formatter. Read more

Implementors§