weavatrix-git 0.1.0

Dependency-free, evidence-carrying Git repository reader
Documentation
use crate::{CommitMetadata, Object, ObjectId, PathBloom, Repository, Result};

impl Repository {
    #[must_use]
    pub fn multi_pack_index_count(&self) -> usize {
        self.store.multi_pack_index_count()
    }

    #[must_use]
    pub fn commit_graph_layer_count(&self) -> usize {
        self.graph
            .as_ref()
            .map_or(0, crate::commit_graph::CommitGraph::layer_count)
    }

    pub fn commit_maybe_changed_path(
        &self,
        id: ObjectId,
        path: impl AsRef<[u8]>,
    ) -> Result<Option<PathBloom>> {
        self.graph
            .as_ref()
            .map_or(Ok(None), |graph| graph.changed_path(id, path.as_ref()))
    }

    pub fn bitmap_reachable(&self, commit: ObjectId) -> Result<Option<Vec<ObjectId>>> {
        self.store
            .bitmap_reachable(commit, self.limits.max_bitmap_objects)
    }

    pub fn objects_parallel(&self, ids: &[ObjectId]) -> Vec<Result<Object>> {
        crate::parallel::map_slice(ids, |id| self.object(id))
    }

    pub fn commit_metadata_parallel(&self, ids: &[ObjectId]) -> Vec<Result<CommitMetadata>> {
        crate::parallel::map_slice(ids, |id| self.commit_metadata(id))
    }
}