Skip to content

Use standard git diff output even when diff.external is configured - #1092

Closed
marvin-bitterlich wants to merge 1 commit into
pingdotgg:mainfrom
marvin-bitterlich:fix/git-diff-no-ext-diff
Closed

Use standard git diff output even when diff.external is configured#1092
marvin-bitterlich wants to merge 1 commit into
pingdotgg:mainfrom
marvin-bitterlich:fix/git-diff-no-ext-diff

Conversation

@marvin-bitterlich

@marvin-bitterlich marvin-bitterlich commented Mar 14, 2026

Copy link
Copy Markdown

Why?

T3 Code uses git diff output to build patch and stat views in the app. When a user has diff.external configured, those commands can return tool-specific output instead of standard unified diffs, which breaks parsing and rendering.

How?

Added a small shared helper for machine-readable git diff invocations and used it for the server-side diff, stat, and numstat calls that feed status details, commit context, range context, and checkpoint diffs.

Added regression tests that configure diff.external and verify the app still receives standard diff output.

Decisions

Note

Add --no-ext-diff to all git diff invocations to ignore configured external diff tools

  • Introduces machineReadableGitDiffArgs helper in diffArgs.ts that prepends "diff" and "--no-ext-diff" to any provided git diff arguments.
  • Updates GitCore (statusDetails, prepareCommitContext, readRangeContext) and CheckpointStore (diffCheckpoints) to use this helper, ensuring diff.external config is ignored.
  • Adds integration tests in GitCore.test.ts that configure an external diff script and assert it is not invoked by prepareCommitContext or readRangeContext.

Macroscope summarized 115cf97.

@coderabbitai

coderabbitai Bot commented Mar 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 779b3522-f109-416f-a1e2-bcad1e5e1009

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 14, 2026
@@ -0,0 +1,3 @@
export function machineReadableGitDiffArgs(...args: ReadonlyArray<string>): ReadonlyArray<string> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this helper really provides value since it increases the overall complexity by making you need to go to a different file to figure out what we're actually calling

imo you should just add the --no-ext-diff flag to the existing diff command call sites rather than trying to decrease duplication with a helper

@marvin-bitterlich
marvin-bitterlich deleted the fix/git-diff-no-ext-diff branch March 30, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

External diff tool breaks diff display

2 participants