pub struct CommitRef<'a> {
pub tree: &'a BStr,
pub parents: SmallVec<[&'a BStr; 1]>,
pub author: SignatureRef<'a>,
pub committer: SignatureRef<'a>,
pub encoding: Option<&'a BStr>,
pub message: &'a BStr,
pub extra_headers: Vec<(&'a BStr, Cow<'a, BStr>)>,
}
Expand description
A git commit parsed using from_bytes()
.
A commit encapsulates information about a point in time at which the state of the repository is recorded, usually after a
change which is documented in the commit message
.
Fields§
§tree: &'a BStr
HEX hash of tree object we point to. Usually 40 bytes long.
Use tree()
to obtain a decoded version of it.
parents: SmallVec<[&'a BStr; 1]>
HEX hash of each parent commit. Empty for first commit in repository.
Who wrote this commit. Name and email might contain whitespace and are not trimmed to ensure round-tripping.
Use the author()
method to received a trimmed version of it.
committer: SignatureRef<'a>
Who committed this commit. Name and email might contain whitespace and are not trimmed to ensure round-tripping.
Use the committer()
method to received a trimmed version of it.
This may be different from the author
in case the author couldn’t write to the repository themselves and
is commonly encountered with contributed commits.
encoding: Option<&'a BStr>
The name of the message encoding, otherwise UTF-8 should be assumed.
message: &'a BStr
The commit message documenting the change.
extra_headers: Vec<(&'a BStr, Cow<'a, BStr>)>
Extra header fields, in order of them being encountered, made accessible with the iterator returned by extra_headers()
.
Implementations§
Source§impl<'a> CommitRef<'a>
impl<'a> CommitRef<'a>
Sourcepub fn message_summary(&self) -> Cow<'a, BStr>
pub fn message_summary(&self) -> Cow<'a, BStr>
Return exactly the same message as MessageRef::summary()
.
Sourcepub fn message_trailers(&self) -> Trailers<'a> ⓘ
pub fn message_trailers(&self) -> Trailers<'a> ⓘ
Return an iterator over message trailers as obtained from the last paragraph of the commit message. May be empty.
Source§impl<'a> CommitRef<'a>
impl<'a> CommitRef<'a>
Access
Sourcepub fn parents(&self) -> impl Iterator<Item = ObjectId> + '_
pub fn parents(&self) -> impl Iterator<Item = ObjectId> + '_
Returns an iterator of parent object ids
Sourcepub fn extra_headers(
&self,
) -> ExtraHeaders<impl Iterator<Item = (&BStr, &BStr)>>
pub fn extra_headers( &self, ) -> ExtraHeaders<impl Iterator<Item = (&BStr, &BStr)>>
Returns a convenient iterator over all extra headers.
Return the author, with whitespace trimmed.
This is different from the author
field which may contain whitespace.
Sourcepub fn committer(&self) -> SignatureRef<'a>
pub fn committer(&self) -> SignatureRef<'a>
Return the committer, with whitespace trimmed.
This is different from the committer
field which may contain whitespace.
Sourcepub fn message(&self) -> MessageRef<'a>
pub fn message(&self) -> MessageRef<'a>
Returns a partially parsed message from which more information can be derived.