Summary
Git's core.quotepath configuration option defaults to true, which causes git commands such as ls-files, diff --name-only, log --name-only, and status --porcelain to emit non-ASCII paths in quoted, octal-escaped form — for example, "src/n\303\244me.rs" including literal quote characters. Consumers that split the output on / then see a phantom directory beside the real one, visually splitting a source tree in two. A path containing a plain space is not quoted, which makes the bug easy to miss.
The fix is one token: pass -c core.quotepath=off before the git subcommand, because -c is a global option. This issue recurs across a codebase, and it is common to fix only one call site at a time while leaving others broken.
Key Points
core.quotepathdefaults to ON.- Non-ASCII paths are output with literal double-quote characters and octal escapes.
- Ordinary spaces are not quoted — a near-miss that hides the problem.
- Fix pattern:
run_git(&["-c", "core.quotepath=off", "ls-files"]). - The global
-coption must precede the subcommand. - A repo-scope grep found zero occurrences of
quotepathacrosssrc/,tests/, andscripts/, while 14+ production call sites consume git-emitted paths. status --porcelainalso quotes paths and was not named in any filed issue.
Concepts
- core.quotepath — Git config option controlling whether non-ASCII file paths are quoted and octal-escaped in output.
- run_git / run_git_in_dir / run_git_output — central git invocation helpers in
src/git.rswith 117 callers; a natural chokepoint for a global fix. - cfg(test) destructive-command guard — test-time protection that parses git command argv shape.
- detect_git_redirection_escape — safety check in
safety.rsthat also parses git argv shape.