Skip to content

Keep the unified diff on the side that is a workspace file - #2845

Merged
vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:compare-unified-diff-workspace-file
Jul 31, 2026
Merged

Keep the unified diff on the side that is a workspace file#2845
vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:compare-unified-diff-workspace-file

Conversation

@vogella

@vogella vogella commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   54m 3s ⏱️ - 1m 30s
 4 700 tests ±0   4 678 ✅ ±0   22 💤 ±0  0 ❌ ±0 
11 994 runs  ±0  11 841 ✅ ±0  153 💤 ±0  0 ❌ ±0 

Results for commit 920ab8e. ± Comparison against base commit 55d7ddf.

@vogella
vogella merged commit 40b0730 into eclipse-platform:master Jul 31, 2026
18 checks passed
@vogella
vogella deleted the compare-unified-diff-workspace-file branch July 31, 2026 14:35
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.

1 participant