Skip to main content

GitPort

Trait GitPort 

Source
pub trait GitPort {
    // Required methods
    fn is_git_repo(&self, path: &Path) -> Result<bool, GitError>;
    fn get_github_remote(&self, path: &Path) -> Result<Option<String>, GitError>;
    fn create_worktree(
        &self,
        repo_path: &Path,
        worktree_path: &Path,
        branch: &str,
        create_branch: bool,
    ) -> Result<(), GitError>;
    fn remove_worktree(
        &self,
        repo_path: &Path,
        worktree_path: &Path,
    ) -> Result<(), GitError>;
    fn current_branch(&self, path: &Path) -> Result<String, GitError>;
    fn get_pr_branch(&self, pr_url: &str) -> Result<String, GitError>;
    fn staged_diff(&self, path: &Path) -> Result<String, GitError>;
    fn unstaged_diff(&self, path: &Path) -> Result<String, GitError>;
    fn log_commits(
        &self,
        path: &Path,
        base: &str,
    ) -> Result<Vec<CommitInfo>, GitError>;
    fn rename_branch(
        &self,
        repo_path: &Path,
        old: &str,
        new: &str,
    ) -> Result<(), GitError>;
    fn move_worktree(
        &self,
        repo_path: &Path,
        old_path: &Path,
        new_path: &Path,
    ) -> Result<(), GitError>;
}

Required Methods§

Source

fn is_git_repo(&self, path: &Path) -> Result<bool, GitError>

Source

fn get_github_remote(&self, path: &Path) -> Result<Option<String>, GitError>

Source

fn create_worktree( &self, repo_path: &Path, worktree_path: &Path, branch: &str, create_branch: bool, ) -> Result<(), GitError>

Source

fn remove_worktree( &self, repo_path: &Path, worktree_path: &Path, ) -> Result<(), GitError>

Source

fn current_branch(&self, path: &Path) -> Result<String, GitError>

Source

fn get_pr_branch(&self, pr_url: &str) -> Result<String, GitError>

Source

fn staged_diff(&self, path: &Path) -> Result<String, GitError>

Source

fn unstaged_diff(&self, path: &Path) -> Result<String, GitError>

Source

fn log_commits( &self, path: &Path, base: &str, ) -> Result<Vec<CommitInfo>, GitError>

Source

fn rename_branch( &self, repo_path: &Path, old: &str, new: &str, ) -> Result<(), GitError>

Source

fn move_worktree( &self, repo_path: &Path, old_path: &Path, new_path: &Path, ) -> Result<(), GitError>

Implementors§