fix: use -z option to git commands to handle unicode file paths #10844
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.
Description
Summary
Added the
-zoption to git commands to separate file paths with null bytes (\0) instead of newlines.Why?
When git diff outputs file paths containing Unicode characters (e.g.,
apps/docs/app/테스트.ts), it wraps them in quotes (e.g.,"apps/docs/app/\355\205\214\354\212\244\355\212\270.ts"). This causes issues in theis_file_in_packagefunction, which fails to properly recognize these file paths.Importance
If a filename contains non-ASCII characters (such as CJK), Turbo’s filter logic fails.
This creates friction for developers in non-English locales, including myself.
In particular, turbo-ignore does not trigger correctly, which can break deployments on Vercel.
Solution
Changes made:
-zoption todiff-tree,ls-files, anddiffcommandsadd_files_from_stdoutfunction to process null byte-separated outputTesting Instructions
Reproducing Unicode Filename Diff Format
git diff-tree -r --name-only --no-commit-id HEAD~1 HEAD
git diff-tree -r --name-only --no-commit-id HEAD~2 HEAD
Here filenames are emitted as raw UTF-8 with NUL delimiters (no quotes).
Reproducing the Turbo Failure
turbo run "build" --filter="docs...[HEAD~1]" --dry=json -vv
turbo run "build" --filter="docs...[HEAD~2]" --dry=json -vv
In both cases,
apps/docswas modified.However, in the first case the
docsbuild is not triggered due to quoted path handling.Reproduction after this change