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; onlyparent, the editedauthor/committerfields and the now-invalidgpgsigheaders change; - the branch ref is moved with a compare-and-swap against the tip the plan was built from.
Structs§
- Branch
Head - The branch a rewrite will move.
- Edit
- Requested changes for one commit.
Nonekeeps 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§
- Committer
Mode - 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
planto the checked-out branch, which must still point atexpected_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.