summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-03-21 16:14:03 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-03-21 16:14:12 +0100
commit88fffedd99e64175260e2db7c55887395aba48ab (patch)
treede683049ea98c7c899d70bf32f9ce49fbcbb4478 /org.eclipse.jgit.test/tst/org
parent6a7a265b4d2da67dcebeb978d54416446e726eb7 (diff)
parent08a5d2771d641b2f69e588ce11028d26323283aa (diff)
downloadjgit-88fffedd99e64175260e2db7c55887395aba48ab.tar.gz
jgit-88fffedd99e64175260e2db7c55887395aba48ab.zip
Merge branch 'stable-5.1' into stable-5.2
* stable-5.1: Fix GC to delete empty fanout directories after repacking Change-Id: I0cf4d26bdee5ecee43e723c4176efbce777acabc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPruneNonReferencedTest.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPruneNonReferencedTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPruneNonReferencedTest.java
index 5b1a4178a6..345207089f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPruneNonReferencedTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPruneNonReferencedTest.java
@@ -47,6 +47,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import java.io.File;
import java.util.Collections;
import java.util.Date;
@@ -113,8 +114,24 @@ public class GcPruneNonReferencedTest extends GcTestCase {
fsTick();
gc.gc();
stats = gc.getStatistics();
+ assertNoEmptyFanoutDirectories();
assertEquals(0, stats.numberOfLooseObjects);
assertEquals(8, stats.numberOfPackedObjects);
assertEquals(2, stats.numberOfPackFiles);
}
+
+ private void assertNoEmptyFanoutDirectories() {
+ File[] fanout = repo.getObjectsDirectory().listFiles();
+ for (File f : fanout) {
+ if (f.isDirectory()) {
+ String[] entries = f.list();
+ if (entries == null || entries.length == 0) {
+ assertFalse(
+ "Found empty fanout directory "
+ + f.getAbsolutePath() + " after pruning",
+ f.getName().length() == 2);
+ }
+ }
+ }
+ }
}