Expand description
The capture under capture order:
the capture lock, the store identity, the sequence and captured.json.
What:
The capture under capture order:
the per-worktree capture lock,
the store identity,
the sequence allocation and its durable write,
the listing of the paths the capture read from the worktree,
and captured.json.
Why:
Every commit transaction captures its content while holding the short per-worktree capture lock
and takes the next sequence number under it,
so sequence numbers give one total order of the captured disk states of a worktree.
The incumbent and this wrapper share the store,
so the lock, the identity and the write order must match exactly
(src/policy-engine/commit-capture-order-store.ts,
commit-capture-order-capture.ts).
In TS you’d write (pseudocode):
const { stamp, value } = await captureInOrder({ gitDir, capture });Structs§
- Capture
Indexes - What: The index and object-store inputs of one listing. Why: Staging and listing read the private index, and only staging writes objects into the shadow store.
- Capture
Stamp - What: Position of one capture in its worktree’s capture order. Why: Sequence numbers are only comparable within one store generation, so the identity travels with the number.
Enums§
- Capture
Order Error - Failure of a capture under capture order. Each variant keeps the incumbent’s wording, so a diagnostic reads the same from either wrapper.
Constants§
- CAPTURED_
FILENAME - Name of the captured record inside a transaction directory.
Functions§
- capture_
commit_ content - What:
Runs the capture under capture order and journals it.
Why:
The sequence is taken before the capture reads any bytes,
and
captured.jsonis written only after the worktree listing is known. - capture_
in_ order - What: Runs one capture under the per-worktree capture lock and stamps it with the next sequence number. Why: The lock is held only for the capture itself, never across hooks, the editor or landing.
- indexed_
request - What:
A Git request that reads or writes one private index,
ignoring the invocation’s global options as the incumbent does.
Why:
GIT_INDEX_FILEandGIT_OBJECT_DIRECTORYselect the private state. - list_
worktree_ captured_ paths - What: Lists the paths the capture read from the worktree, in the incumbent’s order. Why: Explicit-path commits read every path the private index changes against the base; index commits that stage worktree content read only the paths their staging changed; any other index commit read no worktree bytes at capture.
- write_
captured_ record - What:
Writes
captured.jsonexclusively and makes it durable. Why: A transaction directory holds one captured record, and a second write means a bug, so the exclusive open refuses it. - write_
sequence - What: Writes the sequence file through a temporary file and a rename, so a reader sees the old number or the new one. Why: A crash after the rename leaves only a gap in the numbers.