Struct git2::Object [] [src]

pub struct Object<'repo> {
    // some fields omitted
}

A structure to represent a git object

Methods

impl<'repo> Object<'repo>

fn id(&self) -> Oid

Get the id (SHA1) of a repository object

fn kind(&self) -> Option<ObjectType>

Get the object type of an object.

If the type is unknown, then None is returned.

fn peel(&self, kind: ObjectType) -> Result<Object<'repo>, Error>

Recursively peel an object until an object of the specified type is met.

If you pass Any as the target type, then the object will be peeled until the type changes (e.g. a tag will be chased until the referenced object is no longer a tag).

fn short_id(&self) -> Result<Buf, Error>

Get a short abbreviated OID string for the object

This starts at the "core.abbrev" length (default 7 characters) and iteratively extends to a longer string if that length is ambiguous. The result will be unambiguous (at least until new objects are added to the repository).

fn as_commit(&self) -> Option<&Commit<'repo>>

Attempt to view this object as a commit.

Returns None if the object is not actually a commit.

fn as_tag(&self) -> Option<&Tag<'repo>>

Attempt to view this object as a tag.

Returns None if the object is not actually a tag.

fn as_tree(&self) -> Option<&Tree<'repo>>

Attempt to view this object as a tree.

Returns None if the object is not actually a tree.

fn as_blob(&self) -> Option<&Blob<'repo>>

Attempt to view this object as a blob.

Returns None if the object is not actually a blob.

fn describe(&self, opts: &DescribeOptions) -> Result<Describe, Error>

Describes a commit

Performs a describe operation on this commitish object.

Trait Implementations

impl<'repo> Clone for Object<'repo>

fn clone(&self) -> Object<'repo>

fn clone_from(&mut self, source: &Self)

impl<'repo> Drop for Object<'repo>

fn drop(&mut self)