Skip to content

Pass --no-ext-diff to git diff invocations in git extension#295262

Open
JamieMagee wants to merge 1 commit intomicrosoft:mainfrom
JamieMagee:jamiemagee/fix-no-ext-diff
Open

Pass --no-ext-diff to git diff invocations in git extension#295262
JamieMagee wants to merge 1 commit intomicrosoft:mainfrom
JamieMagee:jamiemagee/fix-no-ext-diff

Conversation

@JamieMagee
Copy link
Member

Fixes #295057

When a user has an external diff tool configured via diff.external (e.g. difftastic), git hands off diff output to that tool. Since the git extension parses diff output programmatically, this breaks features like "Generate Commit Message" and SCM change detection.

This adds --no-ext-diff to every git diff, git diff-tree, and git log -p/--shortstat invocation in extensions/git/src/git.ts. The flag tells git to use its built-in diff engine regardless of user configuration. None of these callsites want custom diff formatting.

How to test:

  1. Configure an external diff tool: git config --global diff.external difft
  2. Make a change in a tracked file
  3. Verify SCM changes display correctly and "Generate Commit Message" works
  4. git config --global --unset diff.external to clean up

When a user has an external diff tool configured (e.g. difftastic),
git hands off diff output to that tool instead of producing its own.
Since VS Code parses diff output programmatically, this breaks features
like Generate Commit Message and SCM change detection.

Add --no-ext-diff to every git diff, diff-tree, and log -p/--shortstat
call in the git extension so git always uses its built-in diff engine.

Fixes microsoft#295057
Copilot AI review requested due to automatic review settings February 13, 2026 21:50
@vs-code-engineering
Copy link

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • extensions/git/src/git.ts

@JamieMagee JamieMagee changed the title Pass --no-ext-diff to git diff invocations in git extension Pass --no-ext-diff to git diff invocations in git extension Feb 13, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where the VS Code git extension fails when users have external diff tools (e.g., difftastic) configured via diff.external. The extension parses git diff output programmatically, but external diff tools produce non-standard output or may fail when invoked headlessly, breaking features like "Generate Commit Message" and SCM change detection.

Changes:

  • Added --no-ext-diff flag to all git diff invocations throughout the git extension
  • Added --no-ext-diff flag to git diff-tree invocations
  • Added --no-ext-diff flag to git log invocations that use -p or --shortstat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git diff commands in built-in git extension don't use --no-ext-diff

2 participants