This code does not work if a file is checked-in and is changed in the working dir, but not in the index. Then the method isCachedEntry  returns false and as a consequence later on the comparison is done with the base commit, which is the parent of head.

If a file is in head and has no staged changes then it **is** in the index and GitFileRevision.inIndex(db, gitPath) returns a meaningful value. We should do the same here as in CompareWithIndexActionHandler. There the method getHeadTypedElement does a check if the file exists in the index. If not, it returns a GitCompareFileRevisionEditorInput.EmptyTypedElement with the text "{0} not in index", if yes, it uses GitFileRevision.inIndex.