fix(diff): preserve non-ASCII paths#365
Merged
lizhengfeng101 merged 2 commits intoJul 15, 2026
Merged
Conversation
Disable Git path quoting when generating diffs so parsed paths can be read back correctly. Add regression coverage for workspace, commit, and range modes.
Contributor
|
🔍 OpenCodeReview found 1 issue(s) in this PR.
|
Disable Git path quoting when listing untracked files and add regression coverage for non-ASCII workspace paths.
3 tasks
chethanuk
added a commit
to chethanuk/open-code-review
that referenced
this pull request
Jul 15, 2026
Cosmetic consistency per alibaba#374, discovered in alibaba#365 review. Reorders the two runGit calls so all option flags precede positional args, matching the file's other diff call sites (GetDiff ranges/commit, computeMergeBase). The HEAD call now places --end-of-options before the HEAD ref, hardening against ref-looking filenames; --staged stays with the option flags (it is a flag, not a ref, so no --end-of-options). Pure reordering plus one --end-of-options addition; no flag or value changed. All diff tests pass.
chethanuk
added a commit
to chethanuk/open-code-review
that referenced
this pull request
Jul 15, 2026
Cosmetic consistency per alibaba#374, discovered in alibaba#365 review. Reorders the two runGit calls so all option flags precede positional args, matching the file's other diff call sites (GetDiff ranges/commit, computeMergeBase). The HEAD call now places --end-of-options before the HEAD ref, hardening against ref-looking filenames; --staged stays with the option flags (it is a flag, not a ref, so no --end-of-options). Pure reordering plus one --end-of-options addition; no flag or value changed. All diff tests pass.
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.
Description
Git quotes non-ASCII path bytes by default when
core.quotepathis enabled. The diff parser then receives escaped, quoted paths instead of the literal repository paths, so the generated diff may not be parsed and the file cannot be read back at the selected ref.This change:
-c core.quotepath=falseto the range, commit, and workspace diff-generation commands, matching the existing file-read behavior;Type of Change
How Has This Been Tested?
go test -race -count=1 ./internal/diffgo vet ./...make buildmake coverage(82.3% total; 91.9% forinternal/diff)git diff --check upstream/main...HEADmake testpasses locally (Git 2.49.0)The regression tests create real temporary Git repositories with
core.quotepath=true, covering both tracked and untracked non-ASCII paths. They fail before the corresponding fix and pass after it.Checklist
go fmt,go vet)Related Issues
Closes #361