Keep the unified diff on the side that is a workspace file - #2845
Merged
vogella merged 1 commit intoJul 31, 2026
Merged
Conversation
The unified diff picks the side it overlays: the left one when that is a workspace file, otherwise the right one. For a file that only lives in the git working tree and not in any imported project, neither side is a workspace file, so an editor was opened on the revision instead. That editor comes up empty, and since no diff can be applied to it the classic compare editor opens on top, leaving an empty editor next to it. Only a workspace file is used now; when neither side is one, the classic compare editor takes over on its own.
Contributor
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.
The unified diff is overlaid onto an editor, and it picks the side it opens: the left one when that is a workspace file, otherwise the right one. For a file that only lives in the git working tree and is not part of any imported project, neither side is a workspace file, so the else branch opened an editor on the revision. That editor comes up empty, no diff can be applied to it, and the classic compare editor then opens on top of it, so the user ends up with an empty editor next to the comparison, even though the unified diff preference is on. The same file inside a project works, because then the left side is a workspace file.
Only a side that is a workspace file is used now. When neither side is one, the unified diff steps aside and the classic compare editor opens on its own, without a stray empty editor.
This narrows the unified diff to comparisons that involve a workspace file. Supporting external files is possible in principle, since Eclipse opens those in a text editor as well, but it means choosing the side by editability rather than by workspace membership; that is a separate change.
Reported for a markdown file that only appeared through the Git Staging view.