use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("not a git repository: {0}")]
NotARepo(PathBuf),
#[error("ref CAS conflict on {refname}: expected {expected:?}, found {found:?}")]
CasConflict {
refname: String,
expected: Option<git2::Oid>,
found: Option<git2::Oid>,
},
#[error("precondition failed for {path}: expected {expected:?}, found {found:?}")]
PreconditionFailed {
path: String,
expected: Option<git2::Oid>,
found: Option<git2::Oid>,
},
#[error("git error: {0}")]
Git(#[from] git2::Error),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, Error>;