Skip to main content

Module command_conflict_side

Module command_conflict_side 

Source
Expand description

The checkout and restore command lines that take one side of a conflicted file. What: Which git checkout and git restore command lines take one side of a conflicted file, and the paths they name. Why: During a merge, a rebase, a cherry-pick or a revert the usual way to settle a conflict is git checkout --ours|--theirs -- <path>, git checkout <rev> -- <path> or the git restore forms of the same. The linked-worktree policy rejects them as discarding forms; the conflict-side guard lets them through for conflicted paths after saving the file. Only a command line whose every token is understood qualifies: a form with --force, --patch, --pathspec-from-file, a branch option, an abbreviated git restore option, an index-only restore, or no -- before the paths stays rejected, because what it would discard is not known from the arguments alone.

In TS you’d write (pseudocode):

conflictSideRequest('checkout', ['--theirs', '--', 'a.rs']) // { paths: ['a.rs'] }
conflictSideRequest('checkout', ['-f', '--', 'a.rs'])       // undefined

Structs§

SideRequest
The paths a qualifying command line names, as typed.

Functions§

conflict_side_request
What: The conflict-side reading of a subcommand and its region, or nothing when the command line does not qualify. Why: The caller asks only for checkout and restore; every other command word is not a way to take a side.