DESCRIPTION

Fix the enablement of "Compare with->Index with HEAD"

This menu command makes sense only for staged files, but it was enabled
wrongly also on unstaged files. Apparently that was done on purpose in
commit 6d975be6 to avoid a costly index diff calculation to find out
whether the file was staged.

But if we are able to display "staged" decorations speedily, we
certainly are also able to determine quickly whether a file is staged.
Make isEnabled() properly check again, using the same mechanisms we use
for decorations, which rely on the IndexDiffCache. Remove the extra
check when the command is run, including the dialog.

Change-Id: Ic6ec1e407f2ba1403ae52bc09b4f2546f4e221c8
Signed-off-by: Alayna Houston xxx@xxx.xxx

COMMENTS

author: Alayna Houston
date: 2016-10-11 18:39:41.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2016-10-11 18:39:47.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/9128/

-------------------------------------
author: Brenden Conley
date: 2016-10-11 19:04:36.000000000

Patch Set 1: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/9128/ : UNSTABLE

-------------------------------------
author: Brenden Conley
date: 2016-10-11 19:09:17.000000000

Patch Set 1: -Code-Review

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/9129/

-------------------------------------
author: Brenden Conley
date: 2016-10-11 19:34:58.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/9129/ : SUCCESS

-------------------------------------
author: Douglas Trujillo
date: 2016-10-12 11:22:08.000000000

Patch Set 1:

(1 comment)

Line:133, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java -> I tried this and found that "Compare with > Index with Head" is always greyed out also on a staged change. 

http://imgur.com/a/dpLhZ

Strangely when debugging this method call returns true but still the menu entry is disabled.

-------------------------------------
author: Alayna Houston
date: 2016-10-12 19:17:48.000000000

Patch Set 1:

(1 comment)

Line:133, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java -> Yuck. Hadn't noticed this in my tests.

Not easy to find. And not easy to reproduce. I tried a few things until I was able to pin this: it happens when the selection hasn't changed since the last time the context menu was opened. Then the enablement is not updated.

Caused by the code in RepositoryAction, and the fact that we contribute these actions via a deprecated extension point and <objectContribution>.

I've added a quick fix for now; the proper fix would be to get rid of <objectContribution> (see bug 423932 and bug 422909) and also of the defaultHandlers (still bug 495064, in progress, but it's slow going).

-------------------------------------
author: Gerrit Johnathan Pham
date: 2016-10-12 21:44:15.000000000

Change has been successfully merged into the git repository by Douglas Trujillo

-------------------------------------
