Struct gix::Commit

source ·
pub struct Commit<'repo> {
    pub id: ObjectId,
    pub data: Vec<u8>,
    /* private fields */
}
Expand description

A decoded commit object with access to its owning repository.

Fields§

§id: ObjectId

The id of the commit

§data: Vec<u8>

The fully decoded commit data

Implementations§

source§

impl<'repo> Commit<'repo>

source

pub fn detached(&self) -> ObjectDetached

Create an owned instance of this object, copying our data in the process.

source

pub fn detach(self) -> ObjectDetached

Sever the connection to the Repository and turn this instance into a standalone object.

source§

impl<'repo> Commit<'repo>

source

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

Turn this objects id into a shortened id with a length in hex as configured by core.abbrev.

source

pub fn message(&self) -> Result<MessageRef<'_>, Error>

Parse the commits message into a MessageRef

source

pub fn message_raw(&self) -> Result<&BStr, Error>

Decode the commit object until the message and return it.

source

pub fn message_raw_sloppy(&self) -> &BStr

Obtain the message by using intricate knowledge about the encoding, which is fastest and can’t fail at the expense of error handling.

source

pub fn time(&self) -> Result<Time, Error>

Decode the commit and obtain the time at which the commit was created.

For the time at which it was authored, refer to .decode()?.author.time.

source

pub fn decode(&self) -> Result<CommitRef<'_>, Error>

Decode the entire commit object and return it for accessing all commit information.

It will allocate only if there are more than 2 parents.

Note that the returned commit object does make lookup easy and should be used for successive calls to string-ish information to avoid decoding the object more than once.

source

pub fn iter(&self) -> CommitRefIter<'_>

Return an iterator over tokens, representing this commit piece by piece.

source

pub fn author(&self) -> Result<SignatureRef<'_>, Error>

Return the commits author, with surrounding whitespace trimmed.

source

pub fn committer(&self) -> Result<SignatureRef<'_>, Error>

Return the commits committer. with surrounding whitespace trimmed.

source

pub fn parent_ids(&self) -> impl Iterator<Item = Id<'repo>> + '_

Decode this commits parent ids on the fly without allocating.

source

pub fn tree(&self) -> Result<Tree<'repo>, Error>

Parse the commit and return the tree object it points to.

source

pub fn tree_id(&self) -> Result<Id<'repo>, Error>

Parse the commit and return the tree id it points to.

source

pub fn id(&self) -> Id<'repo>

Return our id own id with connection to this repository.

source

pub fn ancestors(&self) -> Platform<'repo>

Obtain a platform for traversing ancestors of this commit.

source

pub fn describe(&self) -> Platform<'repo>

Available on crate feature revision only.

Create a platform to further configure a git describe operation to find a name for this commit by looking at the closest annotated tags (by default) in its past.

source

pub fn signature( &self ) -> Result<Option<(Cow<'_, BStr>, SignedData<'_>)>, Error>

Extracts the PGP signature and the data that was used to create the signature, or None if it wasn’t signed.

Trait Implementations§

source§

impl<'r> Debug for Commit<'r>

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> Drop for Commit<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'repo> From<Commit<'repo>> for Object<'repo>

source§

fn from(v: Commit<'repo>) -> Self

Converts to this type from the input type.
source§

impl<'repo> From<Commit<'repo>> for ObjectDetached

source§

fn from(v: Commit<'repo>) -> Self

Converts to this type from the input type.
source§

impl<'repo> TryFrom<Object<'repo>> for Commit<'repo>

§

type Error = Object<'repo>

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

fn try_from(value: Object<'repo>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'repo> !RefUnwindSafe for Commit<'repo>

§

impl<'repo> !Send for Commit<'repo>

§

impl<'repo> !Sync for Commit<'repo>

§

impl<'repo> Unpin for Commit<'repo>

§

impl<'repo> !UnwindSafe for Commit<'repo>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.