Struct git_commit::Commit
source · 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
sourceimpl Commit
impl Commit
pub fn new<T>(
tree: Oid,
parents: Vec<Oid>,
author: Author,
committer: Author,
headers: Headers,
message: String,
trailers: T
) -> Selfwhere
T: IntoIterator<Item = OwnedTrailer>,
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 RefUnwindSafe for Commit
impl Send for Commit
impl Sync for Commit
impl Unpin for Commit
impl UnwindSafe for Commit
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more