open-code-review icon indicating copy to clipboard operation
open-code-review copied to clipboard

ocr review --from/--to silently reports "No files changed" when a global diff.external (e.g. difftastic) is configured

Open Christophe1997 opened this issue 5 months ago • 1 comments

OpenCodeReview Version

open-code-review v1.2.6 (48cc6a3) darwin/arm64 built at: 2026-06-09T02:00:04Z

Operating System

macOS (Apple Silicon)

Installation Method

npm (global)

LLM Provider

Anthropic (Claude)

Bug Description

Overview

I have a custom diff driver configured globally (diff.external in ~/.gitconfig), and run ocr in branch range mode. ocr review --from <a> --to <b> reports "No files changed" even though the two refs differ by many files. It seems:

  1. ocr does not insulate its git invocations from user diff config. All internal git diff / git show calls used for parsing should pass --no-ext-diff and --no-textconv (and ideally run with -c core.pager=cat)

Suggested fix

// internal/diff/git.go — isolate from user diff drivers
p.runGit(ctx, "diff", "--no-ext-diff", "--no-textconv", "--src-prefix=a/", "--dst-prefix=b/", "--no-color", "-U"+n, base, p.to, "--")
p.runGit(ctx, "show", "--no-ext-diff", "--no-textconv", "--src-prefix=a/", "--dst-prefix=b/", "--no-color", "-U"+n, p.commit)
  • --no-ext-diff → disables diff.external and per-attribute external drivers
  • --no-textconv → disables textconv filters
  • --src-prefix=a/ --dst-prefix=b/ → forces standard prefixes regardless of diff.noprefix / diff.mnemonicPrefix / custom srcPrefix/dstPrefix

Steps to Reproduce

  1. Configure a custom external diff driver globally (difftastic here) git config --global diff.external difft
  2. In any repo where branch B has changes vs A:
    ocr review --from main --to feature-branch --preview
    # => "No files changed."
    

Expected Behavior

I expect it works well in branch range mode, and sanity check that the refs really differ

git diff --name-only main...feature-branch | wc -l

Logs / Error Output


Additional Context

No response

Christophe1997 avatar Jun 09 '26 04:06 Christophe1997

Hi @Christophe1997, thanks for the detailed report and the suggested fix!

This has been resolved in v1.2.7. Specifically:

  • PR #86 added --no-ext-diff --no-textconv to all internal git diff / git show calls, fixing the core issue with external diff drivers like difftastic.
  • A follow-up commit further added --src-prefix=a/ --dst-prefix=b/ to guard against diff.noprefix / diff.mnemonicPrefix breaking the parser as well.

You can upgrade via:

npm update -g @anthropic-ai/open-code-review

Thanks again for the feedback — really appreciate it!

lizhengfeng101 avatar Jun 09 '26 10:06 lizhengfeng101