pub trait GitOps: Send + Sync {
// Required methods
fn diff(&self, commit: &str) -> Result<Vec<FileDiff>, GitError>;
fn note_read(&self, commit: &str) -> Result<Option<String>, GitError>;
fn note_write(&self, commit: &str, content: &str) -> Result<(), GitError>;
fn note_exists(&self, commit: &str) -> Result<bool, GitError>;
fn file_at_commit(
&self,
path: &Path,
commit: &str,
) -> Result<String, GitError>;
fn commit_info(&self, commit: &str) -> Result<CommitInfo, GitError>;
fn resolve_ref(&self, refspec: &str) -> Result<String, GitError>;
fn config_get(&self, key: &str) -> Result<Option<String>, GitError>;
fn config_set(&self, key: &str, value: &str) -> Result<(), GitError>;
fn log_for_file(&self, path: &str) -> Result<Vec<String>, GitError>;
fn list_annotated_commits(
&self,
limit: u32,
) -> Result<Vec<String>, GitError>;
}Expand description
Abstraction over git operations. MVP implements CliOps (shelling out to git). GixOps (pure Rust via gitoxide) will be added later.
Required Methods§
Sourcefn diff(&self, commit: &str) -> Result<Vec<FileDiff>, GitError>
fn diff(&self, commit: &str) -> Result<Vec<FileDiff>, GitError>
Get the diff for a single commit.
Sourcefn note_read(&self, commit: &str) -> Result<Option<String>, GitError>
fn note_read(&self, commit: &str) -> Result<Option<String>, GitError>
Read a git note from the chronicle notes ref.
Sourcefn note_write(&self, commit: &str, content: &str) -> Result<(), GitError>
fn note_write(&self, commit: &str, content: &str) -> Result<(), GitError>
Write a git note to the chronicle notes ref (overwrites existing).
Sourcefn note_exists(&self, commit: &str) -> Result<bool, GitError>
fn note_exists(&self, commit: &str) -> Result<bool, GitError>
Check if a note exists for a commit.
Sourcefn file_at_commit(&self, path: &Path, commit: &str) -> Result<String, GitError>
fn file_at_commit(&self, path: &Path, commit: &str) -> Result<String, GitError>
Read a file at a specific commit.
Sourcefn commit_info(&self, commit: &str) -> Result<CommitInfo, GitError>
fn commit_info(&self, commit: &str) -> Result<CommitInfo, GitError>
Get commit metadata.
Sourcefn resolve_ref(&self, refspec: &str) -> Result<String, GitError>
fn resolve_ref(&self, refspec: &str) -> Result<String, GitError>
Resolve a ref (branch name, HEAD, etc.) to a SHA.