diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-03-21 16:07:11 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-03-21 16:07:23 +0100 |
commit | 08a5d2771d641b2f69e588ce11028d26323283aa (patch) | |
tree | 482d954808c6c78f37d8ee0c7817111d9936bc4b /org.eclipse.jgit.test/tst | |
parent | 639d53721c47ecf9a079475270fca93580f6b746 (diff) | |
parent | b29bb5cbb00748fb7a4f89c5177391282d7aef66 (diff) | |
download | jgit-08a5d2771d641b2f69e588ce11028d26323283aa.tar.gz jgit-08a5d2771d641b2f69e588ce11028d26323283aa.zip |
Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
Fix GC to delete empty fanout directories after repacking
Change-Id: I5c0e7d59f137c27e4588f20f4472d3ea450cd59c
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.java | 17 |
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); + } + } + } + } } |