Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2019-03-21 14:06:47 +0000
committerMatthias Sohn2019-03-21 14:07:05 +0000
commitf06de6b575f3f40ccd944ed2eb5c43d06666687f (patch)
treebe677438cdd9ae9b64d6c2421626cec388c56f82 /org.eclipse.jgit.test/tst
parentf53c2d11af719cb1ff97ffc1c8046739883c30da (diff)
parent534ede2d8143093110ff9f20ff9b510c690db8d1 (diff)
downloadjgit-f06de6b575f3f40ccd944ed2eb5c43d06666687f.tar.gz
jgit-f06de6b575f3f40ccd944ed2eb5c43d06666687f.tar.xz
jgit-f06de6b575f3f40ccd944ed2eb5c43d06666687f.zip
Merge branch 'stable-4.9' into stable-4.10
* stable-4.9: Fix GC to delete empty fanout directories after repacking Change-Id: Ibdbfe08eb290286fa738010bad1c604e857885cd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-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);
+ }
+ }
+ }
+ }
}

Back to the top