pub struct ReflogEntry {
pub old: ObjectId,
pub new: ObjectId,
pub committer: Signature,
pub message: Vec<u8>,
}Expand description
One format-bearing reflog record, in oldest-to-newest file order.
Zero IDs represent absence. Parsing preserves message and email bytes, trims name delimiter
whitespace, and normalizes numeric timestamps/timezones. Use ReflogRecord to retain the
original lexical record. An omitted message separator maps to
an empty message. Object existence and continuity
between records are not checked.
use girt::{ObjectFormat, ObjectId};
let old = ObjectId::null(ObjectFormat::Sha1);
let new = ObjectId::for_blob(ObjectFormat::Sha1, b"manifest");
let bytes = format!("{old} {new} A <a@example.com> 60 +0000\trecord\n");
let entries = girt::refs::ReflogEntry::parse(ObjectFormat::Sha1, bytes.as_bytes())?;
assert!(entries[0].old.is_null());
assert_eq!(entries[0].message, b"record");Fields§
§old: ObjectIdPrevious object ID, or zero for creation.
new: ObjectIdNew object ID, or zero for deletion.
committer: SignatureCaller-supplied identity, Unix seconds and timezone.
message: Vec<u8>Message bytes without the files separator or final newline. Imported binary records may retain embedded control bytes.
Implementations§
Source§impl ReflogEntry
impl ReflogEntry
Sourcepub fn parse(
format: ObjectFormat,
bytes: &[u8],
) -> Result<Vec<Self>, ReferenceError>
pub fn parse( format: ObjectFormat, bytes: &[u8], ) -> Result<Vec<Self>, ReferenceError>
Parses a complete newline-terminated reflog, returning records in file order.
The caller selects the repository format, including for empty input; every ID must match.
Imported names may be empty or padded; trailing name whitespace is trimmed in the
interpreted value. Signed i64 seconds and four-digit signed zones are accepted, including
noncanonical minutes such as +0060. UTF-8 is not required. Messages may contain tabs.
Use ReflogRecord for exact lexical retention. Short zones, suffix text, and seconds
outside i64 are explicit reader limits; they are not claims of Git invalidity.
§Errors
Rejects malformed or foreign-format IDs, identity/date framing, invalid identities, NUL/CR messages, and truncated records. Errors identify the format rule; filesystem readers add the log path.