Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349418

Summary: Compare with each other not working in the history view
Product: [Technology] EGit Reporter: James Blackburn <jamesblackburn+eclipse>
Component: UIAssignee: Project Inbox <egit.ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: lenzai2004-dev, marc.khouzam, matthias.sohn, robin
Version: 1.0   
Target Milestone: 2.1-M1   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:

Description James Blackburn CLA 2011-06-15 07:11:00 EDT
Eclipse EGit    1.0.0.201106081625-r    org.eclipse.egit.feature.group
Eclipse EGit
Eclipse JGit    1.0.0.201106081625-r    org.eclipse.jgit.feature.group
Eclipse JGit

It seems that the history view's right click > compare with each other doesn't work in some circumstances.

From a freshly started eclipse, with no editors open, I open the history view on a project and configured it to show all branches and show all changes in the repository.  I then selected two neighbouring commits, where only one file was changed, and chose to 'compare with each other'.  

Having done this I get an empty compare editor.  

Trying again on the same two commits (without closing the empty compare editor), I get an NPE:
java.lang.NullPointerException
at org.eclipse.egit.ui.internal.merge.GitCompareEditorInput.equals(GitCompareEditorInput.java:378)
at org.eclipse.egit.ui.internal.CompareUtils.findReusableCompareEditor(CompareUtils.java:297)
at org.eclipse.egit.ui.internal.CompareUtils.openInCompare(CompareUtils.java:265)
at org.eclipse.egit.ui.internal.history.command.AbstractHistoryCommandHandler.openInCompare(AbstractHistoryCommandHandler.java:71)
at org.eclipse.egit.ui.internal.history.command.CompareVersionsHandler.execute(CompareVersionsHandler.java:73)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)

This happens reliably and repeatedly in 1.0.
Comment 1 James Blackburn CLA 2011-06-15 07:12:48 EDT
Note that trying with the HEAD commit and its predecessor seems to work, but older commits in the history view don't seem to work.
Comment 2 lenzai CLA 2011-07-03 08:11:54 EDT
maybe related.
with a freshly started eclipse.

compare file with head => works fine
compare project with head => when I click any file in the egit tree view : no view open.
Comment 3 Robin Stocker CLA 2012-06-24 14:28:05 EDT
Fix pushed for review:

https://git.eclipse.org/r/6479
Comment 4 Matthias Sohn CLA 2012-08-06 19:06:58 EDT
merged as b927e3ac025f88285a0e1de7b376830d3778d8e9
Comment 5 Robin Stocker CLA 2013-05-19 19:57:15 EDT
*** Bug 368460 has been marked as a duplicate of this bug. ***