summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRobin Stocker2011-05-19 08:30:28 (EDT)
committer Robin Stocker2011-05-19 08:30:28 (EDT)
commit5f6d41066b08777c26f9db5d33cabf18dd57720e (patch)
tree5aa2bf9c46d0e38b5813d02adda2784b56ab7857
parentacd66fa90f9ae1e4b48c7edd3f7a9bbed64cf861 (diff)
downloadegit-5f6d41066b08777c26f9db5d33cabf18dd57720e.zip
egit-5f6d41066b08777c26f9db5d33cabf18dd57720e.tar.gz
egit-5f6d41066b08777c26f9db5d33cabf18dd57720e.tar.bz2
Fix exception in isEnabled of CompareIndexWithHeadActionHandlerrefs/changes/70/3470/1
This fixes the following exception currently happening each time the context menu of a Git-shared project is opened: java.lang.IllegalArgumentException: Empty path not permitted. This happened in isStaged because resRelPath is "" when a project is at the root of the repository. Change-Id: Ie85d5f95b6c6d4b8154c220cfa1f7fd499a616ef Signed-off-by: Robin Stocker <robin@nibor.org>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java
index dddbee3..f677991 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java
@@ -106,6 +106,11 @@ public class CompareIndexWithHeadActionHandler extends RepositoryActionHandler {
IResource resource) {
String resRelPath = RepositoryMapping.getMapping(resource).getRepoRelativePath(resource);
+ // This action at the moment only works for files anyway
+ if (resRelPath == null || resRelPath.length() == 0) {
+ return false;
+ }
+
try {
FileTreeIterator fileTreeIterator = new FileTreeIterator(repository);
IndexDiff indexDiff = new IndexDiff(repository, Constants.HEAD,