Skip to content

fix: keep non-ASCII paths unescaped in the extracted diff - #93

Open
vitali87 wants to merge 1 commit into
fix/preserve-crlffrom
fix/unicode-paths-in-diff
Open

fix: keep non-ASCII paths unescaped in the extracted diff#93
vitali87 wants to merge 1 commit into
fix/preserve-crlffrom
fix/unicode-paths-in-diff

Conversation

@vitali87

Copy link
Copy Markdown
Owner

Problem

With git's default core.quotePath=true, any non-ASCII path in git diff output is octal-escaped and quoted: +++ "b/new file \303\274.txt". unidiff cannot parse that for new/deleted files (DiffParseError: Target without source), so pr-split split aborts with no plan; for modified files it parses but records the literal quoted string as the path, so materialisation later fails with fatal: path '"a/\303\274n\303\257.txt"' does not exist. Found by the end-to-end hunt (ünï.txt, new file ü.txt).

Fix

extract_diff runs git -c core.quotePath=false diff …. Verified end to end: modified, added, deleted, and nested (dir ü/日本語.txt) non-ASCII paths round-trip through extract → parse → branch creation, and the sub-PR tree is byte-identical to dev; also checked under LANG=C. git show, git add --, and the worktree writes all take the raw path fine.

Tests

Real-git test with a modified ünï.txt and an added new file ü.txt (fails on base); the argv assertion updated.

Local review: 5/5. 464 tests pass, ruff clean. Stacked on #70 (stack #81) because it edits the same git diff invocation.

Follow-up (pre-existing): paths containing ", \, tab or newline are still C-quoted regardless of core.quotePath.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ab473e11-12da-4e24-8430-984c122055e9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

git quotes and octal-escapes non-ASCII paths by default
(core.quotePath). unidiff then fails on new/deleted files ('Target
without source') and, for modified files, records the literal quoted
string as the path so materialization asks git for a path that does
not exist. Run git diff with core.quotePath=false.
@vitali87
vitali87 force-pushed the fix/unicode-paths-in-diff branch from 3ab75d4 to 5d2f16b Compare August 31, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant