Skip to main content

Repository

Struct Repository 

Source
pub struct Repository { /* private fields */ }

Implementations§

Source§

impl Repository

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const fn object_format(&self) -> ObjectFormat

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for Repository

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.