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
impl Commit
pub fn new<I, T>( tree: Oid, parents: Vec<Oid>, author: Author, committer: Author, headers: Headers, message: String, trailers: I, ) -> Self
Sourcepub fn read(repo: &Repository, oid: Oid) -> Result<Self, Read>
pub fn read(repo: &Repository, oid: Oid) -> Result<Self, Read>
Read the Commit
from the repo
that is expected to be found at
oid
.
Sourcepub fn write(&self, repo: &Repository) -> Result<Oid, Error>
pub fn write(&self, repo: &Repository) -> Result<Oid, Error>
Write the given Commit
to the repo
. The resulting Oid
is the identifier for this commit.
The author of this commit, i.e. the header corresponding to author
.
Sourcepub fn committer(&self) -> &Author
pub fn committer(&self) -> &Author
The committer of this commit, i.e. the header corresponding to
committer
.
Sourcepub fn signatures(&self) -> impl Iterator<Item = Signature<'_>> + '_
pub fn signatures(&self) -> impl Iterator<Item = Signature<'_>> + '_
The Signature
s found in this commit, i.e. the headers corresponding
to gpgsig
.
Sourcepub fn headers(&self) -> impl Iterator<Item = (&str, &str)>
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
.
Sourcepub fn values<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a str> + '_
pub fn values<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a str> + '_
Iterate over the Headers
values that match the provided name
.
Sourcepub fn push_header(&mut self, name: &str, value: &str)
pub fn push_header(&mut self, name: &str, value: &str)
Push a header to the end of the headers section.
pub fn trailers(&self) -> impl Iterator<Item = &OwnedTrailer>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Commit
impl RefUnwindSafe for Commit
impl Send for Commit
impl Sync for Commit
impl Unpin for Commit
impl UnwindSafe for Commit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more