Expand description
Pure core of the index-against-HEAD check.
What:
The pure core of the index-against-HEAD check used by the commit-only transform.
Why:
The caller runs real Git;
this module only says which command to run and what its
exit status means,
so the decision is testable without a process.
In TS you’d write (pseudocode):
// indexStateFromExit(exitCode): 'differs' | 'matches' | 'unknown'Enums§
- Index
VsHead - What:
Comparison of staged content with
HEAD. Anenumis a closed set of alternatives. Why:Unknownmeans Git could not answer (unbornHEAD, no repository); the transform then defers to real Git instead of rejecting.
Constants§
- INDEX_
QUERY - The query whose exit status answers the question: 0 for equal, 1 for staged changes.
Functions§
- index_
query_ arguments - What:
Build the real-Git argument list:
the caller’s global options,
then the query.
&[OsString]borrows the global prefix;Vec<OsString>is the owned result. Why: The check must inspect the same repository the commit will run in, so-C,--git-dirand the other global options are forwarded unchanged. - index_
state_ from_ exit - What:
Interpret the query’s exit status.
Option<i32>is “an exit code, or nothing when a signal ended the process”;i32is the platform’s exit-code integer type. Why: Only the two documented codes are answers; everything else is “Git cannot say”.