Trait git_repository::prelude::ObjectAccessExt[][src]

pub trait ObjectAccessExt: Access + Sized {
    fn find_object(
        &self,
        id: impl Into<ObjectId>
    ) -> Result<ObjectRef<'_, Self>, Error> { ... }
fn try_find_object(
        &self,
        id: impl Into<ObjectId>
    ) -> Result<Option<ObjectRef<'_, Self>>, Error> { ... }
fn write_object(&self, object: impl WriteTo) -> Result<Oid<'_, Self>, Error> { ... }
fn tag(
        &self,
        name: impl AsRef<str>,
        target: impl AsRef<oid>,
        target_kind: Kind,
        tagger: Option<&SignatureRef<'_>>,
        message: impl AsRef<str>,
        constraint: PreviousValue
    ) -> Result<Reference<'_, Self>, Error> { ... }
fn commit<Name, E>(
        &self,
        reference: Name,
        author: &SignatureRef<'_>,
        committer: &SignatureRef<'_>,
        message: impl AsRef<str>,
        tree: impl Into<ObjectId>,
        parents: impl IntoIterator<Item = impl Into<ObjectId>>
    ) -> Result<Oid<'_, Self>, Error>
    where
        Name: TryInto<FullName, Error = E>,
        Error: From<E>
, { ... } }
Expand description

Methods related to object creation.

Provided methods

Find the object with id in the object database or return an error if it could not be found.

There are various legitimate reasons for an object to not be present, which is why try_find_object(…) might be preferable instead.

Important

As a shared buffer is written to back the object data, the returned ObjectRef will prevent other find_object() operations from succeeding while alive. To bypass this limit, clone this easy::Access instance.

Performance Note

In order to get the kind of the object, is must be fully decoded from storage if it is packed with deltas. Loose object could be partially decoded, even though that’s not implemented.

Try to find the object with id or return None it it wasn’t found.

Important

As a shared buffer is written to back the object data, the returned ObjectRef will prevent other try_find_object() operations from succeeding while alive. To bypass this limit, clone this easy::Access instance.

Write the given object into the object database and return its object id.

Create a tag reference named name (without refs/tags/ prefix) pointing to a newly created tag object which in turn points to target and return the newly created reference.

It will be created with constraint which is most commonly to only create it or to force overwriting a possibly existing tag.

Create a new commit object with author, committer and message referring to tree with parents, and point reference to it. The commit is written without message encoding field, which can be assumed to be UTF-8.

reference will be created if it doesn’t exist, and can be "HEAD" to automatically write-through to the symbolic reference that HEAD points to if it is not detached. For this reason, detached head states cannot be created unless the HEAD is detached already. The reflog will be written as canonical git would do, like <operation> (<detail>): <summary>.

The first parent id in parents is expected to be the current target of reference and the operation will fail if it is not. If there is no parent, the reference is expected to not exist yet.

The method fails immediately if a reference lock can’t be acquired.

Implementors