pub struct Commit { /* private fields */ }
Expand description

A git commit in its object description form, i.e. the output of git cat-file for a commit object.

Implementations§

source§

impl Commit

source

pub fn new<P, I, T>( tree: Oid, parents: P, author: Author, committer: Author, headers: Headers, message: String, trailers: I ) -> Selfwhere P: IntoIterator<Item = Oid>, I: IntoIterator<Item = T>, OwnedTrailer: From<T>,

source

pub fn read(repo: &Repository, oid: Oid) -> Result<Self, Read>

Read the Commit from the repo that is expected to be found at oid.

source

pub fn write(&self, repo: &Repository) -> Result<Oid, Write>

Write the given Commit to the repo. The resulting Oid is the identifier for this commit.

source

pub fn tree(&self) -> Oid

The tree Oid this commit points to.

source

pub fn parents(&self) -> impl Iterator<Item = Oid> + '_

The parent Oids of this commit.

source

pub fn author(&self) -> &Author

The author of this commit, i.e. the header corresponding to author.

source

pub fn committer(&self) -> &Author

The committer of this commit, i.e. the header corresponding to committer.

source

pub fn message(&self) -> &str

The message body of this commit.

source

pub fn signatures(&self) -> impl Iterator<Item = Signature<'_>> + '_

The Signatures found in this commit, i.e. the headers corresponding to gpgsig.

source

pub fn headers(&self) -> impl Iterator<Item = (&str, &str)>

The Headers found in this commit.

Note: these do not include tree, parent, author, and committer.

source

pub fn values<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a str> + '_

Iterate over the Headers values that match the provided name.

source

pub fn push_header(&mut self, name: &str, value: &str)

Push a header to the end of the headers section.

source

pub fn trailers(&self) -> impl Iterator<Item = &OwnedTrailer>

Trait Implementations§

source§

impl Debug for Commit

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromStr for Commit

§

type Err = Parse

The associated error which can be returned from parsing.
source§

fn from_str(buffer: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl ToString for Commit

source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl TryFrom<&[u8]> for Commit

§

type Error = Parse

The type returned in the event of a conversion error.
source§

fn try_from(data: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Buf> for Commit

§

type Error = Parse

The type returned in the event of a conversion error.
source§

fn try_from(value: Buf) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.