pub struct Repository { /* private fields */ }Implementations§
Source§impl Repository
impl Repository
Sourcepub fn open(root: &Path, object_format: ObjectFormat) -> Result<Self, Error>
pub fn open(root: &Path, object_format: ObjectFormat) -> Result<Self, Error>
Opens the primary non-bare form: the root’s final entry and its direct
.git child as no-follow directory handles; every later object access
is relative to those handles.
§Errors
RepositoryUnavailable for a bare repository, .git file, symlink,
or missing primary object database.
Sourcepub fn read_object(
&self,
resources: &mut GitResources,
oid: &Oid,
) -> Result<Object, Error>
pub fn read_object( &self, resources: &mut GitResources, oid: &Oid, ) -> Result<Object, Error>
Total loose-first lookup for one full OID in the declared namespace.
§Errors
ObjectMissing when no loose or validated pack row holds the OID,
ObjectUnreadable for any corruption or non-ordinary entry, and
ResourceLimit for cap crossings.
Sourcepub fn read_expected(
&self,
resources: &mut GitResources,
oid: &Oid,
expected: ObjectKind,
) -> Result<Object, Error>
pub fn read_expected( &self, resources: &mut GitResources, oid: &Oid, expected: ObjectKind, ) -> Result<Object, Error>
§Errors
Everything read_object fails with, plus ObjectWrongKind when the
reconstructed type differs from expected.
Sourcepub fn read_expected_capped(
&self,
resources: &mut GitResources,
oid: &Oid,
expected: ObjectKind,
cap: ValueCap,
) -> Result<Object, Error>
pub fn read_expected_capped( &self, resources: &mut GitResources, oid: &Oid, expected: ObjectKind, cap: ValueCap, ) -> Result<Object, Error>
Reads one object under a smaller contextual inflated cap, which applies before the general Git object cap when a header declares a larger value. The cap binds the requested object only, never a delta base.
§Errors
Everything read_expected fails with; a declared size past the cap is
a ResourceLimit carrying the cap’s own resource.
pub const fn object_format(&self) -> ObjectFormat
Sourcepub fn read_index_bytes(
&self,
resources: &mut GitResources,
) -> Result<Vec<u8>, Error>
pub fn read_index_bytes( &self, resources: &mut GitResources, ) -> Result<Vec<u8>, Error>
Reads the current raw .git/index bytes through the retained handle:
an ordinary no-follow entry, bounded by the raw staged-index cap with
the exact declared length observed.
§Errors
IndexInvalid for a missing or non-ordinary entry, and the
git-index-bytes crossing for an oversized one.
Sourcepub fn has_object(
&self,
resources: &mut GitResources,
oid: &Oid,
) -> Result<bool, Error>
pub fn has_object( &self, resources: &mut GitResources, oid: &Oid, ) -> Result<bool, Error>
Whether the primary object database holds the OID, without reading or reconstructing the object.
§Errors
Pack enumeration defects and their resource crossings.
Sourcepub fn verify_index_unchanged(
&self,
resources: &mut GitResources,
initial: &[u8],
) -> Result<(), Error>
pub fn verify_index_unchanged( &self, resources: &mut GitResources, initial: &[u8], ) -> Result<(), Error>
The end-of-scan race check: reopens the current index entry, rereads it boundedly, and accepts byte identity or an equal reparsed logical projection. Anything else is solely a snapshot change.
§Errors
SnapshotChanged, or the index byte crossing during the reread.