bug(diff): quoted Git paths can make changed files disappear from review
OpenCodeReview Version
main @ a003b9341a65130b024829101ea35494b56569e1
Operating System
macOS (Apple Silicon)
Installation Method
Built from source
LLM Provider
OpenAI
Bug Description
ParseDiffText starts a file section only when the header matches:
^diff --git a/(.+?) b/(.+)$
Git quotes pathnames containing control characters such as tabs or newlines, even with core.quotepath=false. For example:
diff --git "a/tab\tname.go" "b/tab\tname.go"
That header does not match the regex, so current is never created and the entire changed file is silently omitted from the parsed diff. This creates a review coverage gap: OCR can report a successful review without inspecting the file.
Steps to Reproduce
-
Create a Git repository and add a tracked Go file whose name contains a tab:
name=$'tab\tname.go' printf 'package p\n' > "$name" git add . && git commit -m initial printf 'package p\n\nfunc Changed() {}\n' > "$name" -
Run the same diff shape used by OCR:
git -c core.quotepath=false diff --no-ext-diff --no-color --unified=3 --ignore-cr-at-eol HEAD -- -
Pass the output to
ParseDiffTextor run the equivalent OCR review path. -
Observe that no
Diffentry is emitted for the changed file.
Expected Behavior
OCR should either parse Git's quoted pathname syntax and include the file, or fail explicitly. A changed file must never be silently omitted from review. A robust approach could use a NUL-delimited/raw path source to identify file boundaries.
Logs / Error Output
Observed Git header:
diff --git "a/tab\tname.go" "b/tab\tname.go"
index ...
--- "a/tab\tname.go"
+++ "b/tab\tname.go"
AI/LLM Disclosure
- [ ] I didn't use AI/LLM to assist or generate the content above.
Additional Context
Relevant source:
- https://github.com/alibaba/open-code-review/blob/a003b9341a65130b024829101ea35494b56569e1/internal/diff/parser.go#L20-L25
- https://github.com/alibaba/open-code-review/blob/a003b9341a65130b024829101ea35494b56569e1/internal/diff/parser.go#L71-L87
AI/LLM disclosure: This report was prepared with OpenAI Codex (GPT-5) for source inspection and issue drafting. The Git behavior was reproduced locally by the tool; no project code was modified.