Struct git2::Commit [−][src]
A structure to represent a git commit
Implementations
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.
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]
&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_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> Clone for Commit<'repo>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'repo> Debug for Commit<'repo>
[src]
impl<'repo> Drop for Commit<'repo>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,