Expand description
Landing target comparison, nonce reflog message and compare-and-swap.
What:
Target comparison, the nonce-bearing reflog message and the compare-and-swap a landing uses
to advance its target.
Why:
The reflog subject carries the transaction nonce, so recovery can tell whether the target
advanced to this landing even after a crash (src/policy-engine/commit-landing-support.ts).
The swap runs in the owning worktree’s context, which also writes the real HEAD reflog.
In TS you’d write (pseudocode):
await compareAndSwapTarget({ gitPath, cwd, capture, transactionId, newOid, expectedOld });Structs§
- Compare
AndSwap - What: One compare-and-swap of a landing’s target. Why: Grouping the facts keeps the call site readable and names what the swap depends on.
Functions§
- compare_
and_ swap_ target - What: Advances the target from the expected value to the new commit, in the owning worktree. Why: A nonzero exit is a lost race, not an error: the caller reads the winning value next.
- landing_
reflog_ message - What: Builds the nonce-bearing reflog message of one landed commit. Why: The message is the prefix followed by the commit’s subject, as Git’s own commit reflog writes it.
- landing_
reflog_ prefix - What: The reflog subject prefix carrying the transaction nonce. Why: Recovery searches the reflog for this prefix to find an advanced target.
- same_
target - What: Reports whether two target values are equal. Why: An unborn target equals only another unborn target.