git-next/crates/git/src/validation.rs

38 lines
811 B
Rust
Raw Normal View History

2024-05-23 16:50:36 +01:00
use crate as git;
use git_next_config::BranchName;
pub type Result = core::result::Result<Positions, Error>;
pub struct Positions {
pub main: git::Commit,
pub next: git::Commit,
pub dev: git::Commit,
pub dev_commit_history: Vec<git::Commit>,
}
#[derive(Debug, derive_more::Display)]
pub enum Error {
Fetch(git::fetch::Error),
CommitLog(git::commit::log::Error),
2024-05-23 16:50:36 +01:00
#[display("Failed to Reset Branch {branch} to {commit}")]
FailedToResetBranch {
branch: BranchName,
commit: git::Commit,
},
2024-05-23 16:50:36 +01:00
BranchReset(BranchName),
2024-05-23 16:50:36 +01:00
BranchHasNoCommits(BranchName),
2024-05-23 16:50:36 +01:00
DevBranchNotBasedOn(BranchName),
}
impl std::error::Error for Error {}
impl From<git::fetch::Error> for Error {
fn from(value: git::fetch::Error) -> Self {
Self::Fetch(value)
}
}