diff options
author | Christian Halstrick | 2015-11-19 16:28:06 +0000 |
---|---|---|
committer | Matthias Sohn | 2015-11-19 22:05:35 +0000 |
commit | 20ce7751a52160c6f65f9e74c7beb68aebf23b0d (patch) | |
tree | b7b9b7242b00285c7b71d87e51f3c6d5b1d7de8f | |
parent | 89731f49ae33b7b1526ce16b91f1cb2008193c1c (diff) | |
download | egit-20ce7751a52160c6f65f9e74c7beb68aebf23b0d.tar.gz egit-20ce7751a52160c6f65f9e74c7beb68aebf23b0d.tar.xz egit-20ce7751a52160c6f65f9e74c7beb68aebf23b0d.zip |
Show an error if existing index can't be read
In case the index file exists but can't be read show an error instead
assuming an empty index and showing a wrong status
Bug: 482607
JGit-dependency: I50bfcb719c45caac3cb5550a8b16307c2ea9def4
Change-Id: I556039e0ce1eb3cbab8165627016b64416efb26c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 files changed, 7 insertions, 0 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/CoreText.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/CoreText.java index 0d84b07d50..0a53028534 100644 --- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/CoreText.java +++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/CoreText.java @@ -284,6 +284,9 @@ public class CoreText extends NLS { public static String CreatePatchOperation_patchFileCouldNotBeWritten; /** */ + public static String IndexDiffCacheEntry_cannotReadIndex; + + /** */ public static String IndexDiffCacheEntry_errorCalculatingIndexDelta; /** */ diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/coretext.properties b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/coretext.properties index fd05d7571f..c4da92e440 100644 --- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/coretext.properties +++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/coretext.properties @@ -109,6 +109,7 @@ CreatePatchOperation_repoRequired=A repository is required to create a patch CreatePatchOperation_cannotCreatePatchForMergeCommit=Cannot create patch for merge commit CreatePatchOperation_couldNotFindProject=Could not find project for {0} in repository {1} CreatePatchOperation_patchFileCouldNotBeWritten=Patch file could not be written +IndexDiffCacheEntry_cannotReadIndex=Cannot read existing git index IndexDiffCacheEntry_errorCalculatingIndexDelta=Failed to load index for repository {0} IndexDiffCacheEntry_refreshingProjects=Refreshing projects of repository {0} IndexDiffCacheEntry_reindexing=Computing Git status for repository {0} diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java index 9bc9545744..b7f28b8063 100644 --- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java +++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java @@ -45,6 +45,7 @@ import org.eclipse.egit.core.internal.trace.GitTraceLocation; import org.eclipse.egit.core.internal.util.ProjectUtil; import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCacheIterator; +import org.eclipse.jgit.errors.IndexReadException; import org.eclipse.jgit.events.IndexChangedEvent; import org.eclipse.jgit.events.IndexChangedListener; import org.eclipse.jgit.events.ListenerHandle; @@ -305,6 +306,8 @@ public class IndexDiffCacheEntry { } notifyListeners(); return Status.OK_STATUS; + } catch (IndexReadException e) { + return Activator.error(CoreText.IndexDiffCacheEntry_cannotReadIndex, e); } catch (IOException e) { if (GitTraceLocation.INDEXDIFFCACHE.isActive()) GitTraceLocation.getTrace().trace( |