Expand description
Replay: raw commit objects as bytes, the unsigned rewrite and signed-rebuild inputs (replay_object).
What:
Raw commit objects as exact bytes:
parsing, the unsigned replay rewrite, and the inputs a signed replay passes to git commit-tree.
Why:
Replay keeps every byte of the prepared commit except its tree and parent lines,
so headers and message stay bytes;
a non-UTF-8 encoding commit round-trips unchanged.
In TS you’d write (pseudocode):
parseRawCommit(bytes); rewriteCommitObject({ commit, treeOid, parentOid });Structs§
- RawCommit
- What: A parsed raw commit. Why: Replay reads the tree, the encoding, whether the object is signed, and the identities; the message and headers are copied back as bytes.
- RawCommit
Header - What: One header with its continuation lines. Why: The rewrite copies each header’s bytes unchanged.
- Replay
Object Error - What:
A raw commit that cannot be replayed:
no
treeheader, or an identity header that is missing or malformed. Why: Replay fails the transaction rather than guess at identities.
Functions§
- dropped_
replay_ headers - What:
The names of headers a signed replay drops, each once in object order.
Why:
Replay reports them with
replay-headers-dropped, so the operator learns a hook or tool added headers thatgit commit-treecannot reproduce. - identity_
environment - What:
The Git identity environment of one
authororcommitterheader, asgit commit-treereads it: the name, the email, and the date as@<seconds> <zone>. Why: A signed replay reproduces the prepared commit’s identities and dates through these variables. - parse_
raw_ commit - What:
Parses a raw commit object from
git cat-file commitoutput. Why: Replay reads the tree, encoding, and signature state, and keeps the rest as bytes. - rewrite_
commit_ object - What:
Rewrites an unsigned commit onto a new tree and parent, keeping every other byte.
Why:
The replayed object must differ from the prepared one only in
treeandparent, so the message, encoding, identities, and custom headers stay byte-identical.