pub struct CommitRef<'a> { /* private fields */ }Expand description
Parsed commit headers and message body borrowing from the object bytes.
Implementations§
Source§impl<'a> CommitRef<'a>
impl<'a> CommitRef<'a>
Sourcepub fn parse(data: &'a [u8]) -> Result<Self>
pub fn parse(data: &'a [u8]) -> Result<Self>
Parse a commit object without allocating author, committer, or message strings.
§Errors
Returns Error::CorruptObject when required headers are missing or malformed.
Sourcepub fn parents_iter(&self) -> impl Iterator<Item = &ObjectId> + '_
pub fn parents_iter(&self) -> impl Iterator<Item = &ObjectId> + '_
Iterate parent commit ids.
Raw author header payload (after author ), with continuation lines merged.
Sourcepub fn committer_raw(&self) -> &[u8] ⓘ
pub fn committer_raw(&self) -> &[u8] ⓘ
Raw committer header payload (after committer ), with continuation lines merged.
Sourcepub fn encoding_raw(&self) -> Option<&[u8]>
pub fn encoding_raw(&self) -> Option<&[u8]>
Optional encoding header value bytes when present and UTF-8.
Sourcepub fn extra_headers(&self) -> Cow<'_, [u8]>
pub fn extra_headers(&self) -> Cow<'_, [u8]>
Extra header bytes (gpgsig, mergetag, change-id, …) excluding tree/parent/author/committer/encoding.
Sourcepub fn message_bytes(&self) -> &[u8] ⓘ
pub fn message_bytes(&self) -> &[u8] ⓘ
Commit message body bytes (everything after the blank line).
Decoded author identity line (uses Self::encoding_raw when set).
Sourcepub fn committer(&self) -> String
pub fn committer(&self) -> String
Decoded committer identity line (uses Self::encoding_raw when set).
Sourcepub fn message(&self) -> Cow<'_, str>
pub fn message(&self) -> Cow<'_, str>
Decoded commit message (uses Self::encoding_raw when set).
Sourcepub fn committer_timestamp(&self) -> i64
pub fn committer_timestamp(&self) -> i64
Committer unix seconds for --until / --since filtering (unknown → 0).
Sourcepub fn committer_unix_seconds_for_ordering(&self) -> i64
pub fn committer_unix_seconds_for_ordering(&self) -> i64
Committer unix seconds for rev-list date ordering (unknown → 0).
Author unix seconds for rev-list author-date ordering (unknown → 0).
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Re-serialize using the original header block (byte-identical when the source object was valid).
Sourcepub fn to_owned(&self) -> CommitData
pub fn to_owned(&self) -> CommitData
Build an owning CommitData matching super::parse_commit output.