Skip to main content

Module landing_support

Module landing_support 

Source
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§

CompareAndSwap
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.