Struct git2::Commit [−][src]
pub struct Commit<'repo> { /* fields omitted */ }
Expand description
A structure to represent a git commit
Implementations
impl<'repo> Commit<'repo>
[src]
impl<'repo> Commit<'repo>
[src]pub fn tree_id(&self) -> Oid
[src]
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 raw(&self) -> *mut git_commit
[src]
pub fn raw(&self) -> *mut git_commit
[src]Get access to the underlying raw pointer.
pub fn message(&self) -> Option<&str>
[src]
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]
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]
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]
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]
pub fn message_raw_bytes(&self) -> &[u8]ⓘ
[src]Get the full raw message of a commit.
pub fn raw_header(&self) -> Option<&str>
[src]
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 header_field_bytes<T: IntoCString>(&self, field: T) -> Result<Buf, Error>
[src]
pub fn header_field_bytes<T: IntoCString>(&self, field: T) -> Result<Buf, Error>
[src]Get an arbitrary header field.
pub fn raw_header_bytes(&self) -> &[u8]ⓘ
[src]
pub fn raw_header_bytes(&self) -> &[u8]ⓘ
[src]Get the full raw text of the commit header.
pub fn summary(&self) -> Option<&str>
[src]
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]
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]
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.
pub fn parents<'a>(&'a self) -> Parents<'a, 'repo>ⓘ
[src]
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]
pub fn parent_ids(&self) -> ParentIds<'_>
[src]Creates a new iterator over the parents of this commit.
pub fn author_with_mailmap(
&self,
mailmap: &Mailmap
) -> Result<Signature<'static>, Error>
[src]
pub fn author_with_mailmap(
&self,
mailmap: &Mailmap
) -> Result<Signature<'static>, Error>
[src]Get the author of this commit, using the mailmap to map names and email addresses to canonical real names and email addresses.
pub fn committer_with_mailmap(
&self,
mailmap: &Mailmap
) -> Result<Signature<'static>, Error>
[src]
pub fn committer_with_mailmap(
&self,
mailmap: &Mailmap
) -> Result<Signature<'static>, Error>
[src]Get the committer of this commit, using the mailmap to map names and email addresses to canonical real names and email addresses.
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>
[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]
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]
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]
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 into_object(self) -> Object<'repo>
[src]
pub fn into_object(self) -> Object<'repo>
[src]Consumes Commit to be returned as an Object
Trait Implementations
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
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more