Follow-up to #381, which normalized the argument ordering in
workspaceTrackedDiff (options -> positional ref -> --) but stopped short of
the --end-of-options guard. This adds it before HEAD in the first runGit
call, bringing workspace mode fully in line with the canonical range/commit/
merge-base calls in this file (git.go:119/126/256), which already require
git >= 2.24.
The --staged fallback call is untouched: it has no positional ref (only the
-- pathspec separator), so --end-of-options would guard nothing there.
Also documents why the --staged fallback is load-bearing (repos with no
commits have no HEAD, so `git diff HEAD` fails while `git diff --staged`
still surfaces staged changes against the empty tree) and pins it with
TestWorkspaceDiffNoCommitsUsesStagedFallback.
Closes#374
* fix(diff): preserve non-ASCII paths
Disable Git path quoting when generating diffs so parsed paths can be read back correctly. Add regression coverage for workspace, commit, and range modes.
* fix(diff): preserve untracked non-ASCII paths
Disable Git path quoting when listing untracked files and add regression coverage for non-ASCII workspace paths.
When a file was renamed on the target branch, ocr review emitted
'[ocr] WARNING: cannot read file <old path> at ref <to>: exit status 128'.
Two compounding bugs:
1. The parser required 'a/'/'b/' prefixes when matching '--- /dev/null' /
'+++ /dev/null', but git emits these lines without prefixes, so
IsNew/IsDeleted were never set and deleted files fell through to a
doomed 'git show ref:<old path>'.
2. 'rename from' / 'rename to' extended headers were never parsed, and
git diff/show call sites did not force rename detection, so renames
degraded to delete+add whenever the user had diff.renames=false.
Fixes:
- Parse 'rename from'/'rename to', 'new file mode', 'deleted file mode'
and unprefixed /dev/null markers in ParseDiffText.
- Pass --find-renames to all git diff/show invocations so rename
detection no longer depends on user config.
- Add IsRenamed to model.Diff (json: is_renamed) and prefer it in
diffStatus.
- Add parser unit tests and a range-mode rename regression test.
Fixes#99
Add --src-prefix=a/ --dst-prefix=b/ to all git diff/show calls so that
user config (diff.noprefix, diff.mnemonicPrefix) cannot alter the prefix
format the parser depends on. Also add missing ModeCommit test coverage.
When a user has configured a global external diff tool (diff.external /
GIT_EXTERNAL_DIFF) or a textconv filter, git diff/show emit the tool's
output instead of unified diff text. The provider's parser keys off
`diff --git` headers, so it parses zero diffs and the review silently
reports "No files changed".
Add --no-ext-diff --no-textconv to all four git diff/show call sites in
internal/diff/git.go (ModeRange diff, ModeCommit show, and both
workspaceTrackedDiff calls). merge-base and ls-files are left untouched
since they don't run the diff machinery.
Adds an integration test that initializes a real git repo, activates a
garbage GIT_EXTERNAL_DIFF script, and asserts the provider still parses
a non-empty diff (fails before this change, passes after).
Closes#82
AI-assisted contribution.