Skip to content

git: fix blame decorations for third-party extension diff editors#287965

Open
AndyBodnar wants to merge 1 commit intomicrosoft:mainfrom
AndyBodnar:fix/git-blame-third-party-diff-281045
Open

git: fix blame decorations for third-party extension diff editors#287965
AndyBodnar wants to merge 1 commit intomicrosoft:mainfrom
AndyBodnar:fix/git-blame-third-party-diff-281045

Conversation

@AndyBodnar
Copy link
Copy Markdown

I was using Git Graph to view commit diffs and noticed the blame decorations weren't showing up, even though they work fine when opening diffs from the Source Control view. Same thing happens with GitLens.

Dug into it and the issue is that getWorkingTreeDiffInformation() only recognizes vscode's built-in git URI scheme, so it returns undefined for extensions that use their own schemes. The blame controller then bails out early thinking there's no valid diff info.

The fix checks if there's any valid diff information available (regardless of scheme) and treats it as viewing committed content - which makes sense since these extensions are showing you historical states, not uncommitted changes. This lets the blame decorations display correctly.

I tested this with both Git Graph and GitLens - blame info now shows up properly in their diff views.

Fixes #281045

When diff editors are opened from third-party extensions like Git Graph
or GitLens, the built-in git blame decorations were not displayed. This
happened because getWorkingTreeDiffInformation() only recognizes VSCode's
git URI scheme, returning undefined for other schemes used by extensions.

This fix detects when there is valid diff information from third-party
extensions (any diff with an original URI that is not stale) and treats
the editor as viewing committed content. Since these extensions typically
show committed file states rather than working tree modifications, we
set workingTreeChanges to empty, allowing blame decorations to display
correctly.

Fixes microsoft#281045
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

@lszomoru

Matched files:

  • extensions/git/src/blame.ts

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.

Built-in git blame editor decorations are not applied when diff editor is opened via third-party extension (e.g. Git Graph / GitLens)

2 participants