Strip pathspec and attribute-source settings from the walk's git (improvise-a0i3)

GIT_LITERAL/GLOB/NOGLOB/ICASE_PATHSPECS and GIT_ATTR_SOURCE are
process-wide, so --local-env-vars names none of them. Remove them in
git() beside the local-vars loop.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
Edward Langley
2026-09-23 17:30:59 -07:00
parent da0eb3d7cb
commit 4cef40c951
2 changed files with 54 additions and 0 deletions
+13
View File
@@ -48,6 +48,15 @@ fn every_shipped_document_loads() {
}
}
/// Settings that change how git reads a pathspec or finds attributes.
const PATHSPEC_AND_ATTRIBUTE_SETTINGS: [&str; 5] = [
"GIT_LITERAL_PATHSPECS",
"GIT_GLOB_PATHSPECS",
"GIT_NOGLOB_PATHSPECS",
"GIT_ICASE_PATHSPECS",
"GIT_ATTR_SOURCE",
];
/// `git -C root`, with every repo-local variable a caller exported removed,
/// since `GIT_DIR` and friends override `-C` (improvise-53zz).
fn git(root: &Path) -> std::process::Command {
@@ -59,6 +68,10 @@ fn git(root: &Path) -> std::process::Command {
for name in String::from_utf8(names.stdout).expect("UTF-8").lines() {
git.env_remove(name);
}
// Process-wide, so `--local-env-vars` lists none of them (improvise-a0i3).
for name in PATHSPEC_AND_ATTRIBUTE_SETTINGS {
git.env_remove(name);
}
git.arg("-C").arg(root);
git
}