Pass --no-ext-diff to git diff invocations in git extension#295262
Open
JamieMagee wants to merge 1 commit intomicrosoft:mainfrom
Open
Pass --no-ext-diff to git diff invocations in git extension#295262JamieMagee wants to merge 1 commit intomicrosoft:mainfrom
--no-ext-diff to git diff invocations in git extension#295262JamieMagee wants to merge 1 commit intomicrosoft:mainfrom
Conversation
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
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
--no-ext-diff to git diff invocations in git extension
Contributor
There was a problem hiding this comment.
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-diffflag to allgit diffinvocations throughout the git extension - Added
--no-ext-diffflag togit diff-treeinvocations - Added
--no-ext-diffflag togit loginvocations that use-por--shortstat
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.
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-diffto everygit diff,git diff-tree, andgit log -p/--shortstatinvocation inextensions/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:
git config --global diff.external difftgit config --global --unset diff.externalto clean up