Skip to main content

Module engine

Module engine 

Source
Expand description

History rewrite engine shared by every write mode.

Callers describe what should change with a Plan (edits keyed by the original commit id); apply recreates only the commits that must change:

  • a commit with no edit whose parents are unchanged is reused as-is, so its id, signature and every header stay byte-identical;
  • a recreated commit keeps its raw headers (encoding, mergetag, …) and raw message bytes; only parent, the edited author/committer fields and the now-invalid gpgsig headers change;
  • the branch ref is moved with a compare-and-swap against the tip the plan was built from.

Structs§

BranchHead
The branch a rewrite will move.
Edit
Requested changes for one commit. None keeps the original value.
GitTime
A git timestamp: seconds since the epoch plus the UTC offset in minutes.
Outcome
Result of apply.
Plan
Edits keyed by original commit id, plus the committer policy.

Enums§

CommitterMode
What happens to the committer of a commit whose author fields are edited.

Constants§

BACKUP_PREFIX
Namespace of the backup refs written before every rewrite.

Functions§

apply
Apply plan to the checked-out branch, which must still point at expected_head.
current_branch
Resolve the checked-out branch, rejecting states a rewrite cannot handle.
history
Commits reachable from tip, oldest first (parents before children).
validate_identity_part
Reject values that would corrupt a commit header line.