summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-03-21 16:45:26 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-03-21 16:45:34 +0100
commitc23ccd29b5269e68aa23cbbba30b1b2df521e81f (patch)
treefddfafd97d80eaadac2d45ff690c099049a10b99 /org.eclipse.jgit.test
parent4ade2de34f8256018cc1b574b1d28ad2abae8771 (diff)
parent88fffedd99e64175260e2db7c55887395aba48ab (diff)
downloadjgit-c23ccd29b5269e68aa23cbbba30b1b2df521e81f.tar.gz
jgit-c23ccd29b5269e68aa23cbbba30b1b2df521e81f.zip
Merge branch 'stable-5.2' into stable-5.3
* stable-5.2: Fix GC to delete empty fanout directories after repacking Change-Id: I29e1da15396daaf0036bcb92cfb567cc243db5a1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-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 44fb21dada..878dc860ce 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);
+ }
+ }
+ }
+ }
}