Repository navigation
fix(loop): read untracked paths NUL-separated so a non-ASCII new file no longer crashes a kept-tree refusal - #3625
Merged
Conversation
… no longer crashes a kept-tree refusal Closes #3616. `untracked_paths()` read `git ls-files --others --exclude-standard` line by line. Under git's default `core.quotePath=true` a non-ASCII name such as `docs/café.md` came back C-quoted, quotes included. `retain_tree_after_refusal` passed that string to `git add -N`, which matched nothing and exited 128, so a guard refusal that kept the tree crashed the driver. `untracked_paths()` now passes `-z` and splits on NUL, so callers get the real name (the same read `squash_commit`'s new-file detection uses). Tests: - tests/test_untracked_paths_non_ascii.py:NonAsciiUntrackedPaths — the real name is returned; a kept tree marks a new non-ASCII file intent-to-add without crashing (both fail on the unchanged code) Verification: - scripts/smoke-test.sh: 5163 tests OK (4 skipped), ruff and bats green Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3616.
Root cause
untracked_paths()readgit ls-files --others --exclude-standardline by line. Under git's defaultcore.quotePath=true, a non-ASCII name (docs/café.md) came back C-quoted, quotes included.retain_tree_after_refusalthen passed it togit add -N, which exits 128 on a pathspec that matches nothing. As a result, a guard refusal that kept the tree crashed the driver.Fix
untracked_paths()reads with-zand splits on NUL, so every caller gets the real name. That coversretain_tree_after_refusalandsquash_commit's new-file detection.The issue also names
ignored_pathsandgit_diff_names, which may mis-handle the same names. They don't crash, so they are left for a separate change to keep this fix minimal.Tests
tests/test_untracked_paths_non_ascii.py:untracked_paths()returns the real name.Both tests fail on the unchanged code.
Verification
scripts/smoke-test.sh: 5163 tests OK (4 skipped); ruff and the bats suites are green.🤖 Generated with Claude Code