fix: bulletproof external diff isolation (#380)#409
Merged
tomasz-tomczyk merged 1 commit intomainfrom May 1, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #409 +/- ##
==========================================
+ Coverage 67.26% 67.32% +0.06%
==========================================
Files 26 26
Lines 9650 9665 +15
==========================================
+ Hits 6491 6507 +16
+ Misses 2649 2648 -1
Partials 510 510
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4 tasks
Some users report `--no-ext-diff` not suppressing their configured external diff tool (e.g. difftastic), causing crit to receive non-unified-diff output that breaks rendering. Belt-and-suspenders the disable: pass `-c diff.external=` to override the config at the command line, and strip GIT_EXTERNAL_DIFF / GIT_DIFF_OPTS from the subprocess environment. Both mechanisms run alongside the existing `--no-ext-diff` flag so any one of them is sufficient on its own. The env override is scoped to each git subprocess via cmd.Env — the parent process and shell environment are untouched.
9c3cc59 to
351028f
Compare
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.
Summary
Issue #380 reports duplicate lines in the rendered diff. The reporter has `diff.external = difft` set and noted that `git diff --no-ext-diff` still produced difftastic output for them — meaning crit could be receiving non-unified-diff content that breaks `ParseUnifiedDiff`.
I couldn't reproduce the duplicate locally with a synthetic 3000-line .js fixture matching the screenshot pattern, even with `diff.external = difft` and `diff.suppressBlankEmpty = true`. So the root cause for that specific user is still unconfirmed — but their environment clearly has a path where `--no-ext-diff` alone isn't enough.
This PR makes external-diff disabling defense-in-depth:
If the duplicate truly stems from difft output leaking into crit's diff parser, this fixes it. If it doesn't, this is still correct hygiene and rules out one class of cause.
Test plan
🤖 Generated with Claude Code