fix: add --no-ext-diff to git diff commands to support external diff tools#318
Merged
tomasz-tomczyk merged 2 commits intotomasz-tomczyk:mainfrom Apr 20, 2026
Merged
Conversation
The --numstat call in DiffNumstatDir can also be affected by external diff tools. Add the flag for consistency with the other diff commands. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
Thank you!! 🧡 💛 💚 |
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.
Problem
When a user has an external diff tool configured (e.g. difftastic, delta, or any tool set via
GIT_EXTERNAL_DIFFordiff.externalin gitconfig),git diffoutputs in the tool's custom format rather than standard unified diff. Crit'sParseUnifiedDiffcannot parse these formats, so it returns 0 hunks — causing the diff view to appear completely blank even though the file is correctly detected as modified.This is a silent failure: the file appears in the file list with a modified status icon, but clicking it shows no content. There is no error message to indicate why.
Example
With difftastic configured,
git diff AGENTS.mdoutputs:ParseUnifiedDiffexpects lines starting with+,-,and@@hunk headers — none of which appear in this output. Result: 0 hunks, blank UI.Why detection still worked
The file list detection uses
git diff --name-status, which only outputs filenames and status letters (M,A,D). External diff drivers are not invoked for--name-statusoutput, so detection correctly identifies the file as modified. Only the content diff fetch is broken.Fix
Add
--no-ext-diffto allgit diffinvocations that produce diff content for parsing:fileDiffUnified— default diff (vs HEAD or merge base)fileDiffUnifiedCtx— same, with context cancellation for lazy loadingFileDiffScoped— branch/staged/unstaged scope diffsFileDiffForCommit— per-commit diffs in the commit selector sidebar--no-ext-difftells git to always use its built-in unified diff driver, regardless of any external diff configuration. This is the correct approach for programmatic diff consumption — external diff tools are designed for human-readable terminal output, not machine parsing.The
--name-statusdetection commands are unchanged since they are unaffected by external diff drivers.Testing
All 12 existing
TestFileDiff*tests pass. These tests run against real git repos and cover all modified code paths.Screenshots
Before
After
(Actual diff cutt off here, to hide sensitive info)
