Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-07-29 12:06:39 -0400
committerThomas Wolf2016-08-05 02:49:50 -0400
commit9772f61f8f2d8272f9f5668ebbce5f9724d1a39c (patch)
tree8cdf3e887797ac2f06659a8612c861d9acec80c5 /org.eclipse.egit.core.test/src
parent79c039c0c02fc759b0dc09c02efe6c5e194baac7 (diff)
downloadegit-9772f61f8f2d8272f9f5668ebbce5f9724d1a39c.tar.gz
egit-9772f61f8f2d8272f9f5668ebbce5f9724d1a39c.tar.xz
egit-9772f61f8f2d8272f9f5668ebbce5f9724d1a39c.zip
Recompute index diff on project deletions
IndexDiffCacheEntry recomputed the diff on POST_CHANGE resource change events. This missed project deletions, because by then the project is already gone, is not shared with git anymore, and has no location anymore. Fix by also handling PRE_DELETE events. Remember projects to be deleted and their locations, and once we get the corresponding POST_CHANGE event, force a recalculation if the project directory no longer exists (i.e., the project was also removed on disk). Change-Id: I8cb256540bb14059754c89d952363c08bc9fad72 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.core.test/src')
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntryTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntryTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntryTest.java
index 91b77af4e..9e239c9dc 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntryTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntryTest.java
@@ -84,6 +84,24 @@ public class IndexDiffCacheEntryTest extends GitTestCase {
}
@Test
+ public void testProjectDeletion() throws Exception {
+ prepareCacheEntry();
+
+ testRepository.connect(project.project);
+ waitForJobs(MAX_WAIT_TIME, JobFamilies.INDEX_DIFF_CACHE_UPDATE);
+
+ // Should have something from the project
+ String projectName = project.project.getName();
+ assertTrue(containsItemsStartingWith(
+ entry.getIndexDiff().getUntracked(), projectName + '/'));
+
+ project.project.delete(true, null);
+ waitForJobs(MAX_WAIT_TIME, JobFamilies.INDEX_DIFF_CACHE_UPDATE);
+ assertFalse(containsItemsStartingWith(
+ entry.getIndexDiff().getUntracked(), projectName + '/'));
+ }
+
+ @Test
public void testReloadAndUpdate() throws Exception {
prepareCacheEntry();
@@ -198,6 +216,16 @@ public class IndexDiffCacheEntryTest extends GitTestCase {
return entry;
}
+ private boolean containsItemsStartingWith(Collection<String> values,
+ String prefix) {
+ for (String item : values) {
+ if (item.startsWith(prefix)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
@Override
@Before
public void setUp() throws Exception {

Back to the top