Expand description
Argument transforms of native preparation: normalisation, global split, -a removal and private arguments.
What:
Argument transforms of native preparation:
the normalised commit argument region,
the split of global options from the commit region,
the removal of -a/--all,
and the arguments of the real git commit that run against the complete private index.
Why:
Native git commit must see the policy-settled index, not worktree bytes again,
so selection controls and pathspecs are removed once the private index already holds them
(src/policy-engine/commit-preparation-native.ts,
commit-transaction-selection.ts,
src/parser/commit-normalise.ts).
The removals match the incumbent token for token, including its use of lastIndexOf,
so a -m value equal to a pathspec is removed from the same position.
In TS you’d write (pseudocode):
const invocation = splitCommitInvocation({ args, subcommandIndex });
const commitArgs = withoutAllFlag(invocation.commitArgs);Functions§
- normalise_
commit_ args - What:
Normalises the post-
commitargument region, keeping the pathspec tail verbatim. Why: Later transforms recognize separated values only, and the pathspec tail after--must not change. - private_
explicit_ commit_ args - What:
Removes the pathspec-file controls and the explicit pathspecs,
then the
--separator and-o/--only, from the commit region. Why: The private index already holds the selected paths, so the real commit names none of them. The pathspec removal runs from the last pathspec backwards withlastIndexOf, as the incumbent does. - private_
selection_ commit_ args - What:
Removes the selection controls once the private index holds the exact user choice.
Why:
-i,-p,--include,--interactiveand--patchalready ran against the private index. - resolve_
private_ commit_ args - What:
Chooses the arguments of the real
git commitfor the commit mode. Why: Explicit-path commits drop their pathspecs; index commits drop selection controls only when selection ran privately. - split_
commit_ invocation - What:
Splits a transformed argument list into the kept global options and the commit region.
Why:
Redirecting options (
-C,--git-dir,--work-tree,--bare) would send native commit elsewhere, so they are dropped with their values, and every other global option is kept in order. - without_
all_ flag - What:
Removes
-a/--allfrom the commit region, keeping clustered short options. Why: The private index already holds every tracked change, so native commit must not restage worktree bytes.