Struct git2::Commit

source · []
pub struct Commit<'repo> { /* private fields */ }
Expand description

A structure to represent a git commit

Implementations

Get the id (SHA1) of a repository commit

Get the id of the tree pointed to by this commit.

No attempts are made to fetch an object from the ODB.

Get the tree pointed to by a commit.

Get access to the underlying raw pointer.

Get the full message of a commit.

The returned message will be slightly prettified by removing any potential leading newlines.

None will be returned if the message is not valid utf-8

Get the full message of a commit as a byte slice.

The returned message will be slightly prettified by removing any potential leading newlines.

Get the encoding for the message of a commit, as a string representing a standard encoding name.

None will be returned if the encoding is not known

Get the full raw message of a commit.

None will be returned if the message is not valid utf-8

Get the full raw message of a commit.

Get the full raw text of the commit header.

None will be returned if the message is not valid utf-8

Get an arbitrary header field.

Get the full raw text of the commit header.

Get the short “summary” of the git commit message.

The returned message is the summary of the commit, comprising the first paragraph of the message with whitespace trimmed and squashed.

None may be returned if an error occurs or if the summary is not valid utf-8.

Get the short “summary” of the git commit message.

The returned message is the summary of the commit, comprising the first paragraph of the message with whitespace trimmed and squashed.

None may be returned if an error occurs

Get the long “body” of the git commit message.

The returned message is the body of the commit, comprising everything but the first paragraph of the message. Leading and trailing whitespaces are trimmed.

None may be returned if an error occurs or if the summary is not valid utf-8.

Get the long “body” of the git commit message.

The returned message is the body of the commit, comprising everything but the first paragraph of the message. Leading and trailing whitespaces are trimmed.

None may be returned if an error occurs.

Get the commit time (i.e. committer time) of a commit.

The first element of the tuple is the time, in seconds, since the epoch. The second element is the offset, in minutes, of the time zone of the committer’s preferred time zone.

Creates a new iterator over the parents of this commit.

Creates a new iterator over the parents of this commit.

Get the author of this commit.

Get the author of this commit, using the mailmap to map names and email addresses to canonical real names and email addresses.

Get the committer of this commit.

Get the committer of this commit, using the mailmap to map names and email addresses to canonical real names and email addresses.

Amend this existing commit with all non-None values

This creates a new commit that is exactly the same as the old commit, except that any non-None values will be updated. The new commit has the same parents as the old commit.

For information about update_ref, see Repository::commit.

Get the number of parents of this commit.

Use the parents iterator to return an iterator over all parents.

Get the specified parent of the commit.

Use the parents iterator to return an iterator over all parents.

Get the specified parent id of the commit.

This is different from parent, which will attempt to load the parent commit from the ODB.

Use the parent_ids iterator to return an iterator over all parents.

Casts this Commit to be usable as an Object

Consumes Commit to be returned as an Object

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

Executes the destructor for this type. Read more

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.