Improve error message for identity error

This commit is contained in:
Alexis Sellier 2023-01-30 12:38:59 +01:00
parent 0726c553da
commit 99bd62d276
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions

View File

@ -63,8 +63,8 @@ impl<'a> TryFrom<git2::Reference<'a>> for Ref {
pub enum ProjectError {
#[error("identity branches diverge from each other")]
BranchesDiverge,
#[error("identity branches are in an invalid state")]
InvalidState,
#[error("identity branches missing")]
MissingHeads,
#[error("storage error: {0}")]
Storage(#[from] Error),
#[error("identity document error: {0}")]
@ -304,7 +304,7 @@ impl Repository {
heads.push(oid.into());
}
// Keep track of the longest identity branch.
let mut longest = heads.pop().ok_or(ProjectError::InvalidState)?;
let mut longest = heads.pop().ok_or(ProjectError::MissingHeads)?;
for head in &heads {
let base = self.raw().merge_base(*head, longest)?;