Struct radicle_git_ext::commit::CommitData
source · pub struct CommitData<Tree, Parent> { /* 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 CommitData<Oid, Oid>
impl CommitData<Oid, Oid>
source§impl<Tree, Parent> CommitData<Tree, Parent>
impl<Tree, Parent> CommitData<Tree, Parent>
pub fn new<P, I, T>( tree: Tree, parents: P, author: Author, committer: Author, headers: Headers, message: String, trailers: I, ) -> Self
sourcepub fn parents(&self) -> impl Iterator<Item = Parent> + '_where
Parent: Clone,
pub fn parents(&self) -> impl Iterator<Item = Parent> + '_where
Parent: Clone,
The parents of 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>
sourcepub fn map_tree<U, E, F>(self, f: F) -> Result<CommitData<U, Parent>, E>
pub fn map_tree<U, E, F>(self, f: F) -> Result<CommitData<U, Parent>, E>
Convert the CommitData::tree
into a value of type U
. The
conversion function f
can be fallible.
For example, map_tree
can be used to turn raw tree data into
an Oid
by writing it to a repository.
sourcepub fn map_parents<U, E, F>(self, f: F) -> Result<CommitData<Tree, U>, E>
pub fn map_parents<U, E, F>(self, f: F) -> Result<CommitData<Tree, U>, E>
Convert the CommitData::parents
into a vector containing
values of type U
. The conversion function f
can be
fallible.
For example, map_parents
can be used to resolve the Oid
s
to their respective git2::Commit
s.