DESCRIPTION

Prevent NPE when comparing an untracked file with the index

The compare request does not currently check whether a file is in
the index before displaying the compare editor. This causes
problems when the editor tries to ask the revision for its content
and JGit is unable to return something meaningful here because a
blob cannot actually be found. The fix is to check if an entry
actually exists in the index before trying to create a compare
editor input from it.

Change-Id: I9a1b8bd39aded3dcdeaf523b735f5fcf66f8d152


COMMENTS

author: Jaylon Avila
date: 2010-05-12 01:39:08.000000000

Patch Set 1: No score

One problem is that the editor's title is just "Compare X Current and Current" when doing this. Haven't quite figured out the best way to correct this problem but am open to suggestions.

See GitCompareFileRevisionEditorInput's getTitle() method.

-------------------------------------
author: Jaylon Avila
date: 2010-05-12 10:11:15.000000000

Patch Set 1:

The "ignoring" of IOExceptions might also be a little iffy. CompareWithHeadAction throws it back up as an InvocationTargetException. That can be arranged if desired.

-------------------------------------
author: Carlie Harper
date: 2010-05-17 09:12:27.000000000

Patch Set 1: I would prefer that you didn't submit this; No score

Concerning the IOException: Would you think that in this case we should not bother the user with a dialog? Then we should maybe also change the CompareWithHeadAction. But I think that we should at least log it to the error log.

> One problem is that the editor's title is just "Compare X Current and Current" when doing this. 

I haven't even noticed that, we should however fix it with another patch.

Line:71, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareWithIndexAction.java -> Now the exception isn't logged at all

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