pub async fn uncommitted_paths(root: &Path) -> Result<Uncommitted, GitError>Expand description
The committing index’s paths the working tree does not hold.
The deterministic layer’s tools read the working tree, so after a partial
git add -p, an edit made after staging, or a source file never added at
all they would lint content the commit does not contain - and a
lint-failing staged blob could pass. This listing is what lets the caller
refuse those runs. The index read is the committing one
(StagedView::env), so a hook’s alternate GIT_INDEX_FILE is honoured
the same way it is for the staged diff itself.
The diff argv is deliberately not DIFF: that set carries hunk-only pins
and --diff-filter=ACMRT, which would drop the deletions this query
exists to see (a staged file deleted from the working tree differs
exactly as an edited one does). What stays is the subset a name-only
listing needs: naming every file from the top level and ignoring external
diff drivers and textconv. Both listings are NUL-separated and read as raw
bytes, never through spawn_git, which trims what it reads, so each name
is taken byte for byte. The untracked listing takes -- :/ for the same reason the diff takes --no-relative:
bare ls-files limits its answer to the working directory, so an
untracked helper above it would go unlisted.