diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-03-21 15:35:18 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-03-21 15:35:26 +0100 |
commit | 1a289e342083d18fe4013bdb75004c079122df67 (patch) | |
tree | ed1c2faf564b7e574d3f2b362a3a69bdbf7ef944 /org.eclipse.jgit.test/tst | |
parent | 6a30ffd0338239a49b1d0c34ad827d317d5b15ec (diff) | |
parent | f06de6b575f3f40ccd944ed2eb5c43d06666687f (diff) | |
download | jgit-1a289e342083d18fe4013bdb75004c079122df67.tar.gz jgit-1a289e342083d18fe4013bdb75004c079122df67.zip |
Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
Fix GC to delete empty fanout directories after repacking
Change-Id: I7118b9c668dcbb0f5435cc613e964c557bfebf01
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); + } + } + } + } } |