#[non_exhaustive]pub enum TreeCompareError {
ObjectFormat(ObjectFormatError),
Missing {
id: ObjectId,
path: Vec<u8>,
},
NotTree {
id: ObjectId,
path: Vec<u8>,
actual: ObjectKind,
},
Read {
id: ObjectId,
path: Vec<u8>,
source: Box<ObjectReadError>,
},
Invalid {
id: ObjectId,
path: Vec<u8>,
source: TreeError,
},
Limit(&'static str),
Unsupported(&'static str),
Cancelled,
}Expand description
A structural comparison failed; no partial result is returned.
A missing or invalid tree needs storage recovery; raising a traversal bound does not repair
it. Preserve the ID/path and source chain when reporting TreeCompareError::Read or
TreeCompareError::Invalid. Cancellation and limits discard the whole result.
use std::sync::atomic::AtomicBool;
use girt::{InitKind, ObjectFormat, Repository, TreeCompareError};
let directory = tempfile::tempdir()?;
let repo = Repository::init(
ObjectFormat::Sha1,
directory.path().join("r"),
InitKind::Bare,
)?;
let objects = repo.objects_with(Default::default())?;
assert!(matches!(
objects.compare_trees_with(None, None, Default::default(), &AtomicBool::new(true)),
Err(TreeCompareError::Cancelled)
));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ObjectFormat(ObjectFormatError)
A root uses a different object format from the reader.
Missing
A tree to be traversed is absent.
Fields
NotTree
A visited tree reference resolves to a different object kind.
Fields
actual: ObjectKindObject kind found in storage.
Read
Storage, identity verification or per-read decoding failed.
The effective object-byte limit also includes the remaining cumulative tree-byte budget.
Fields
source: Box<ObjectReadError>Underlying storage failure. Boxed to keep contextual errors compact.
Invalid
A visited tree has unsupported syntax, invalid names, duplicates or invalid Git ordering.
Fields
Limit(&'static str)
A named traversal or output bound was exceeded.
Unsupported(&'static str)
The request needs something tree comparison does not provide.
Cancelled
The caller requested cancellation at a cooperative checkpoint.
Trait Implementations§
Source§impl Debug for TreeCompareError
impl Debug for TreeCompareError
Source§impl Display for TreeCompareError
impl Display for TreeCompareError
Source§impl Error for TreeCompareError
impl Error for TreeCompareError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()