Bug 522739 - [historyView] Double click in in compare mode is broken
Summary: [historyView] Double click in in compare mode is broken
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-25 10:20 EDT by Andrey Loskutov CLA
Modified: 2017-09-27 01:53 EDT (History)
1 user (show)

See Also:


Attachments
Example repo / project (7.05 KB, application/zip)
2017-09-25 10:34 EDT, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2017-09-25 10:20:14 EDT
Open some file from repository in the editor.
Open History view.
Make sure the view is in "compare mode" (button is toggled)
Select commit NOT containing the file we just opened.
Now double click this *commit* in the history view.

AS IS:
The opened diff editor shows diff on active editor file, NOT on file in selected commit. This makes no sense at all. 

TO BE:
The opened diff editor shows diff on the selected (first) file in the selected commit.


Related code is in IOpenListener from org.eclipse.egit.ui.internal.history.CommitGraphTable.CommitGraphTable(Composite, IPageSite, MenuManager, TableLoader, ResourceManager) and ShowVersionsHandler.
Comment 1 Andrey Loskutov CLA 2017-09-25 10:28:09 EDT
The code in ShowVersionsHandler makes no sense. The command tries to detect current file for the diff operation from the history view *input*, but I can have the history opened on a file but see the commits from the entire repo! OMG.
Comment 2 Andrey Loskutov CLA 2017-09-25 10:34:32 EDT
Created attachment 270342 [details]
Example repo / project

Simple repo/project demonstrating the problem. Open .project and a.txt files and try to play with the history view (linked mode + compare mode must be both on).
Comment 3 Andrey Loskutov CLA 2017-09-25 10:48:57 EDT
Expected: the double click on commit in "compare mode" must do something like org.eclipse.egit.ui.internal.history.CommitFileDiffViewer.CommitFileDiffViewer().new IOpenListener() {...}.() or org.eclipse.egit.ui.internal.history.CommitFileDiffViewer.compare.
Comment 4 Thomas Wolf CLA 2017-09-27 01:53:46 EDT
The commit history moreover must evidently not be filtered to that resource.

What should happen is debatable. If the history input is not for a specific resource (click on the repo in the repo view), a double click currently doesn't do anything, and there is no "Compare with workspace" in the context menu either.

So not doing anything for commits not containing the "current" history input resource would be even more consistent.

If we wanted a comparison in such cases, it should be a structure comparison of all files in that commit against the working tree, not just a comparison of the "first" file in that commit.