1pub mod cli_ops;
2pub mod diff;
3
4pub use cli_ops::CliOps;
5pub use diff::{DiffStatus, FileDiff, Hunk, HunkLine};
6
7use crate::error::GitError;
8use std::path::Path;
9
10#[derive(Debug, Clone)]
12pub struct CommitInfo {
13 pub sha: String,
14 pub message: String,
15 pub author_name: String,
16 pub author_email: String,
17 pub timestamp: String,
18 pub parent_shas: Vec<String>,
19}
20
21pub trait GitOps: Send + Sync {
24 fn diff(&self, commit: &str) -> Result<Vec<FileDiff>, GitError>;
26
27 fn note_read(&self, commit: &str) -> Result<Option<String>, GitError>;
29
30 fn note_write(&self, commit: &str, content: &str) -> Result<(), GitError>;
32
33 fn note_exists(&self, commit: &str) -> Result<bool, GitError>;
35
36 fn file_at_commit(&self, path: &Path, commit: &str) -> Result<String, GitError>;
38
39 fn commit_info(&self, commit: &str) -> Result<CommitInfo, GitError>;
41
42 fn resolve_ref(&self, refspec: &str) -> Result<String, GitError>;
44
45 fn config_get(&self, key: &str) -> Result<Option<String>, GitError>;
47
48 fn config_set(&self, key: &str, value: &str) -> Result<(), GitError>;
50
51 fn log_for_file(&self, path: &str) -> Result<Vec<String>, GitError>;
53
54 fn list_annotated_commits(&self, limit: u32) -> Result<Vec<String>, GitError>;
56}