Skip to main content

GitOps

Trait GitOps 

Source
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§

Source

fn diff(&self, commit: &str) -> Result<Vec<FileDiff>, GitError>

Get the diff for a single commit.

Source

fn note_read(&self, commit: &str) -> Result<Option<String>, GitError>

Read a git note from the chronicle notes ref.

Source

fn note_write(&self, commit: &str, content: &str) -> Result<(), GitError>

Write a git note to the chronicle notes ref (overwrites existing).

Source

fn note_exists(&self, commit: &str) -> Result<bool, GitError>

Check if a note exists for a commit.

Source

fn file_at_commit(&self, path: &Path, commit: &str) -> Result<String, GitError>

Read a file at a specific commit.

Source

fn commit_info(&self, commit: &str) -> Result<CommitInfo, GitError>

Get commit metadata.

Source

fn resolve_ref(&self, refspec: &str) -> Result<String, GitError>

Resolve a ref (branch name, HEAD, etc.) to a SHA.

Source

fn config_get(&self, key: &str) -> Result<Option<String>, GitError>

Read a git config value.

Source

fn config_set(&self, key: &str, value: &str) -> Result<(), GitError>

Set a git config value.

Source

fn log_for_file(&self, path: &str) -> Result<Vec<String>, GitError>

List commit SHAs that touched a file (newest first), following renames.

Source

fn list_annotated_commits(&self, limit: u32) -> Result<Vec<String>, GitError>

List commit SHAs that have chronicle notes (newest first), up to limit.

Implementors§