use crate::tree::visit::Relation;
use bstr::BStr;
use gix_hash::ObjectId;
use gix_object::bstr::BString;
use std::collections::VecDeque;
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
#[error(transparent)]
Find(#[from] gix_object::find::existing_iter::Error),
#[error("The delegate cancelled the operation")]
Cancelled,
#[error(transparent)]
EntriesDecode(#[from] gix_object::decode::Error),
}
pub trait Visit {
fn pop_front_tracked_path_and_set_current(&mut self);
fn push_back_tracked_path_component(&mut self, component: &BStr);
fn push_path_component(&mut self, component: &BStr);
fn pop_path_component(&mut self);
fn visit(&mut self, change: visit::Change) -> visit::Action;
}
#[derive(Default, Clone)]
pub struct State {
pub buf1: Vec<u8>,
pub buf2: Vec<u8>,
trees: VecDeque<TreeInfoTuple>,
change_id: visit::ChangeId,
}
type TreeInfoTuple = (Option<ObjectId>, Option<ObjectId>, Option<Relation>);
impl State {
fn clear(&mut self) {
self.trees.clear();
self.buf1.clear();
self.buf2.clear();
self.change_id = 0;
}
}
pub(super) mod function;
pub mod visit;
#[derive(Clone, Debug)]
pub struct Recorder {
path_deque: VecDeque<BString>,
path: BString,
location: Option<recorder::Location>,
pub records: Vec<recorder::Change>,
}
pub mod recorder;