Struct git_object::CommitRef

source ·
pub struct CommitRef<'a> {
    pub tree: &'a BStr,
    pub parents: SmallVec<[&'a BStr; 1]>,
    pub author: SignatureRef<'a>,
    pub committer: SignatureRef<'a>,
    pub encoding: Option<&'a BStr>,
    pub message: &'a BStr,
    pub extra_headers: Vec<(&'a BStr, Cow<'a, BStr>)>,
}
Expand description

A git commit parsed using from_bytes().

A commit encapsulates information about a point in time at which the state of the repository is recorded, usually after a change which is documented in the commit message.

Fields§

§tree: &'a BStr

HEX hash of tree object we point to. Usually 40 bytes long.

Use tree() to obtain a decoded version of it.

§parents: SmallVec<[&'a BStr; 1]>

HEX hash of each parent commit. Empty for first commit in repository.

§author: SignatureRef<'a>

Who wrote this commit. Name and email might contain whitespace and are not trimmed to ensure round-tripping.

Use the author() method to received a trimmed version of it.

§committer: SignatureRef<'a>

Who committed this commit. Name and email might contain whitespace and are not trimmed to ensure round-tripping.

Use the committer() method to received a trimmed version of it.

This may be different from the author in case the author couldn’t write to the repository themselves and is commonly encountered with contributed commits.

§encoding: Option<&'a BStr>

The name of the message encoding, otherwise UTF-8 should be assumed.

§message: &'a BStr

The commit message documenting the change.

§extra_headers: Vec<(&'a BStr, Cow<'a, BStr>)>

Extra header fields, in order of them being encountered, made accessible with the iterator returned by extra_headers().

Implementations§

Return exactly the same message as MessageRef::summary().

Return an iterator over message trailers as obtained from the last paragraph of the commit message. May be empty.

Deserialize a commit from the given data bytes while avoiding most allocations.

Return the tree fields hash digest.

Returns an iterator of parent object ids

Returns a convenient iterator over all extra headers.

Return the author, with whitespace trimmed.

This is different from the author field which may contain whitespace.

Return the committer, with whitespace trimmed.

This is different from the committer field which may contain whitespace.

Returns a partially parsed message from which more information can be derived.

Returns the time at which this commit was created.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Serialize this value into the given Serde serializer. Read more
The type returned in the event of a conversion error.
Performs the conversion.

Serializes this instance to out in the git serialization format.

Returns the type of this object.
Returns the size of this object’s representation (the amount of data which would be written by write_to). Read more
Returns a loose object header based on the object’s data

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.