Skip to main content

Module replay_reverse_apply

Module replay_reverse_apply 

Source
Expand description

Replay: the exact strict reverse check of subsumption (replay_reverse_apply). What: The exact emulation of git apply --reverse --check for one text file: the subsumption test that asks whether a landed change already sits in the prepared bytes. Why: Git’s apply.c matching (apply_one_fragment, find_pos, match_fragment) with its defaults: no context reduction, no whitespace fixing, no overlapping hunks, and anchoring at the file’s start and end. Replay must give the same answer as Git for the same bytes.

In TS you’d write (pseudocode):

reverseApplies({ hunks, prepared }): boolean

Functions§

reverse_applies
What: Whether every hunk of a landed change applies in reverse to the prepared bytes, in order, so the prepared bytes already contain the landed change. Why: Subsumption’s strict check; the one-sided extension in replay_containment covers what this rejects.