Skip to main content

Module replay_object

Module replay_object 

Source
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.
RawCommitHeader
What: One header with its continuation lines. Why: The rewrite copies each header’s bytes unchanged.
ReplayObjectError
What: A raw commit that cannot be replayed: no tree header, 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 that git commit-tree cannot reproduce.
identity_environment
What: The Git identity environment of one author or committer header, as git commit-tree reads 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 commit output. 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 tree and parent, so the message, encoding, identities, and custom headers stay byte-identical.