Struct git2::Commit [−][src]
pub struct Commit<'repo> { /* fields omitted */ }
A structure to represent a git commit
Methods
impl<'repo> Commit<'repo>
[src]
impl<'repo> Commit<'repo>
pub fn id(&self) -> Oid
[src]
pub fn id(&self) -> Oid
Get the id (SHA1) of a repository commit
pub fn tree_id(&self) -> Oid
[src]
pub fn tree_id(&self) -> Oid
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]
pub fn tree(&self) -> Result<Tree<'repo>, Error>
Get the tree pointed to by a commit.
pub fn raw(&self) -> *mut git_commit
[src]
pub fn raw(&self) -> *mut git_commit
Get access to the underlying raw pointer.
pub fn message(&self) -> Option<&str>
[src]
pub fn message(&self) -> Option<&str>
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]
pub fn message_bytes(&self) -> &[u8]
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]
pub fn message_encoding(&self) -> Option<&str>
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]
pub fn message_raw(&self) -> Option<&str>
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]
pub fn message_raw_bytes(&self) -> &[u8]
Get the full raw message of a commit.
pub fn raw_header(&self) -> Option<&str>
[src]
pub fn raw_header(&self) -> Option<&str>
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]
pub fn raw_header_bytes(&self) -> &[u8]
Get the full raw text of the commit header.
pub fn summary(&self) -> Option<&str>
[src]
pub fn summary(&self) -> Option<&str>
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]
pub fn summary_bytes(&self) -> Option<&[u8]>
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]
pub fn time(&self) -> Time
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]
pub fn parents<'a>(&'a self) -> Parents<'a, 'repo>
Creates a new iterator over the parents of this commit.
pub fn parent_ids(&self) -> ParentIds
[src]
pub fn parent_ids(&self) -> ParentIds
Creates a new iterator over the parents of this commit.
Get the author of this commit.
pub fn committer(&self) -> Signature
[src]
pub fn committer(&self) -> Signature
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]
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>
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(&self, i: usize) -> Result<Commit<'repo>, Error>
[src]
pub fn parent(&self, i: usize) -> Result<Commit<'repo>, Error>
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]
pub fn parent_id(&self, i: usize) -> Result<Oid, Error>
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]
pub fn as_object(&self) -> &Object<'repo>
Casts this Commit to be usable as an Object
pub fn into_object(self) -> Object<'repo>
[src]
pub fn into_object(self) -> Object<'repo>
Consumes Commit to be returned as an Object
Trait Implementations
impl<'repo> Debug for Commit<'repo>
[src]
impl<'repo> Debug for Commit<'repo>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<'repo> Clone for Commit<'repo>
[src]
impl<'repo> Clone for Commit<'repo>
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'repo> Drop for Commit<'repo>
[src]
impl<'repo> Drop for Commit<'repo>