Expand description
Whether a direct fix may change a tracked file it did not select.
What: Whether a direct fix may change a tracked file it did not select, and the
patch-conflict message when it may not.
Why: SPEC.md (“Added paths”) admits such a file only when HEAD, the real index, the
private index and the worktree all hold the blob the correction was computed
against, so the fix discards nobody’s change. The reasons and the remedy are the
installed wrapper’s words (commit-transaction-added-paths.ts, assertAddablePath
and its direct-fix message), checked in its order.
In TS you’d write (pseudocode):
// await assertAddablePath({ ..., path, oid, lifecycle: 'direct-fix' }); // throws AddedPathPreconditionErrorConstants§
- ADDED_
PATH_ HEAD_ REASON - The reason
HEADdoes not hold the file the correction was computed against. - ADDED_
PATH_ MISSING_ REASON - The reason the worktree has no copy of the file.
- ADDED_
PATH_ STAGED_ REASON - The reason the index holds a different entry than
HEAD. - ADDED_
PATH_ UNSTAGED_ REASON - The reason the worktree copy differs from
HEAD.
Functions§
- added_
path_ message - What: The direct-fix
patch-conflictmessage for a file and a reason. Why: It names both ways out: select the file, or restore it toHEAD. - head_
mode - What:
HEAD’s mode for the file, or whyHEADand the index rule it out.indexis the private index’s entry, whose object the correction was computed against; for a file the fix did not select it equals the real index’s entry. Why:HEADmust hold the same object as an ordinary file; the index must then hold it withHEAD’s mode. The mode is what the worktree copy is checked against next. - worktree_
refusal - What: Why the worktree copy rules out the file, if it does.
Erris a read the system refused for another reason than the file being absent. Why: The copy must be a plain file, not a link, withHEAD’s executable bit and bytes.
Type Aliases§
- Entry
- What: An index or tree entry: its mode and object. Why: Entries are compared field by field, as the installed wrapper compares mode text and object names.