[][src]Struct git2::Commit

pub struct Commit<'repo> { /* fields omitted */ }

A structure to represent a git commit

Methods

impl<'repo> Commit<'repo>
[src]

pub fn id(&self) -> Oid
[src]

Get the id (SHA1) of a repository commit

pub fn tree_id(&self) -> Oid
[src]

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

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

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

Get the tree pointed to by a commit.

pub fn raw(&self) -> *mut git_commit
[src]

Get access to the underlying raw pointer.

pub fn message(&self) -> Option<&str>
[src]

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

pub fn message_bytes(&self) -> &[u8]
[src]

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

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

pub fn message_encoding(&self) -> Option<&str>
[src]

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

pub fn message_raw(&self) -> Option<&str>
[src]

Get the full raw message of a commit.

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

pub fn message_raw_bytes(&self) -> &[u8]
[src]

Get the full raw message of a commit.

pub fn raw_header(&self) -> Option<&str>
[src]

Get the full raw text of the commit header.

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

pub fn raw_header_bytes(&self) -> &[u8]
[src]

Get the full raw text of the commit header.

pub fn summary(&self) -> Option<&str>
[src]

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.

pub fn summary_bytes(&self) -> Option<&[u8]>
[src]

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

pub fn time(&self) -> Time
[src]

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.

Important traits for Parents<'commit, 'repo>
pub fn parents<'a>(&'a self) -> Parents<'a, 'repo>
[src]

Creates a new iterator over the parents of this commit.

pub fn parent_ids(&self) -> ParentIds
[src]

Creates a new iterator over the parents of this commit.

pub fn author(&self) -> Signature
[src]

Get the author of this commit.

pub fn committer(&self) -> Signature
[src]

Get the committer of this commit.

pub fn amend(
    &self,
    update_ref: Option<&str>,
    author: Option<&Signature>,
    committer: Option<&Signature>,
    message_encoding: Option<&str>,
    message: Option<&str>,
    tree: Option<&Tree<'repo>>
) -> Result<Oid, Error>
[src]

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.

pub fn parent_count(&self) -> usize
[src]

Get the number of parents of this commit.

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

pub fn parent(&self, i: usize) -> Result<Commit<'repo>, Error>
[src]

Get the specified parent of the commit.

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

pub fn parent_id(&self, i: usize) -> Result<Oid, Error>
[src]

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.

pub fn as_object(&self) -> &Object<'repo>
[src]

Casts this Commit to be usable as an Object

pub fn into_object(self) -> Object<'repo>
[src]

Consumes Commit to be returned as an Object

Trait Implementations

impl<'repo> Drop for Commit<'repo>
[src]

impl<'repo> Clone for Commit<'repo>
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'repo> Debug for Commit<'repo>
[src]

Auto Trait Implementations

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

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

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]