Skip to main content

Module commit_worktree_records

Module commit_worktree_records 

Source
Expand description

The worktree completion records of selected corrections and of hook changes. What: The worktree completion records a landed commit owes the worktree: selected final-newline corrections, and the paths a pre-commit hook re-staged. Why: The commit keeps what the private index holds, so the real worktree still holds the bytes the user wrote. After the landing, each recorded file takes the committed bytes only while it still holds its earlier bytes (src/policy-engine/commit-transaction-selected-worktree.ts and commit-hook-changes.ts).

In TS you’d write (pseudocode):

const selected = await selectedWorktreeRecords({ gitPath, cwd, repositoryRoot, indexPath, initialCandidates, newlinePaths });
const changes = await describeHookChanges({ gitPath, cwd, objectDirectory, fromTree, toTree });

Structs§

HookChanges
What: What a pre-commit hook staged beyond the tree it saw. Why: The landing guards these paths against a concurrent staging, and the worktree takes the committed bytes.

Functions§

describe_hook_changes
What: Describe what a hook changed between the tree it saw and the tree it left. Why: The commit keeps the hook’s staged changes, as native Git does; landing reconciles those paths.
selected_worktree_records
What: The records for selected files that final-newline corrected, only where the worktree copy still equals the original staged bytes. Why: A partially staged edit cannot be replaced by a commit correction; the installer re-checks before replacing.
settled_entry
What: The settled mode and object of one path in the private index, or nothing when it has no stage-zero entry. Why: A correction counts only while the settled entry still has the ordinary mode of the original.