Struct gix_object::CommitRef
source · 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.
Trait Implementations§
source§impl<'de: 'a, 'a> Deserialize<'de> for CommitRef<'a>
impl<'de: 'a, 'a> Deserialize<'de> for CommitRef<'a>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<'a> Ord for CommitRef<'a>
impl<'a> Ord for CommitRef<'a>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<'a> PartialEq for CommitRef<'a>
impl<'a> PartialEq for CommitRef<'a>
source§impl<'a> PartialOrd for CommitRef<'a>
impl<'a> PartialOrd for CommitRef<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> WriteTo for CommitRef<'a>
impl<'a> WriteTo for CommitRef<'a>
impl<'a> Eq for CommitRef<'a>
impl<'a> StructuralPartialEq for CommitRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for CommitRef<'a>
impl<'a> RefUnwindSafe for CommitRef<'a>
impl<'a> Send for CommitRef<'a>
impl<'a> Sync for CommitRef<'a>
impl<'a> Unpin for CommitRef<'a>
impl<'a> UnwindSafe for CommitRef<'a>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)