Skip to main content

rskit_git/
core.rs

1//! Core git repository traits.
2
3use std::path::Path;
4
5use rskit_errors::AppResult;
6
7use crate::types::{Oid, Reference};
8
9/// Core git repository operations.
10pub trait Repository {
11    /// Returns the absolute path to the repository root.
12    fn root(&self) -> &Path;
13
14    /// Returns the reference that HEAD points to.
15    fn head(&self) -> AppResult<Reference>;
16
17    /// Resolves a ref name (branch, tag, or SHA prefix) to an OID.
18    fn resolve_ref(&self, refname: &str) -> AppResult<Oid>;
19
20    /// Reports whether the working tree has uncommitted changes.
21    fn is_dirty(&self) -> AppResult<bool>;
22}
23
24/// Raw git command execution escape hatch.
25pub trait Executor {
26    /// Executes the git CLI with the provided arguments.
27    fn exec(&self, args: &[&str]) -> AppResult<Vec<u8>>;
28}