pub trait GitOperations: Send + Sync {
// Required methods
fn clone_repo(
&self,
url: &str,
target: &Path,
options: &CloneOptions,
) -> Result<(), GitError>;
fn fetch(&self, repo_path: &Path) -> Result<FetchResult, GitError>;
fn pull(&self, repo_path: &Path) -> Result<PullResult, GitError>;
fn status(&self, repo_path: &Path) -> Result<RepoStatus, GitError>;
fn is_repo(&self, path: &Path) -> bool;
fn current_branch(&self, repo_path: &Path) -> Result<String, GitError>;
fn remote_url(
&self,
repo_path: &Path,
remote: &str,
) -> Result<String, GitError>;
fn recent_commits(
&self,
repo_path: &Path,
limit: usize,
) -> Result<Vec<String>, GitError>;
}Expand description
Trait for git operations.
This trait abstracts git commands to allow for testing with mocks.
Required Methods§
Sourcefn clone_repo(
&self,
url: &str,
target: &Path,
options: &CloneOptions,
) -> Result<(), GitError>
fn clone_repo( &self, url: &str, target: &Path, options: &CloneOptions, ) -> Result<(), GitError>
Clones a repository to the target path.
§Arguments
url- The clone URL (SSH or HTTPS)target- Target directory pathoptions- Clone options (depth, branch, submodules)