summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorNail Samatov <sanail@yandex.ru>2020-10-27 16:56:24 +0300
committerMatthias Sohn <matthias.sohn@sap.com>2020-11-05 01:31:14 +0100
commitd76088bca6077579f5b8fe669147a31ce7bbd6ad (patch)
tree94a6a7d1783c7ed6369de70ced0e73cfd718a81d /org.eclipse.jgit.test/tst
parentd69fb4d4ac7bcf7d0d84109bba56cf944646fb24 (diff)
downloadjgit-d76088bca6077579f5b8fe669147a31ce7bbd6ad.tar.gz
jgit-d76088bca6077579f5b8fe669147a31ce7bbd6ad.zip
Fix IOException occurring during gc
Fix IOException occurring when calling GC on a repository with absent objects/pack folder. Change-Id: I5be1333a0726f4d7491afd25ddac85451686c30a Signed-off-by: Nail Samatov <sanail@yandex.ru> 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/GcBasicPackingTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcBasicPackingTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcBasicPackingTest.java
index e8d1cd3d7e..d007dd4511 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcBasicPackingTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcBasicPackingTest.java
@@ -80,6 +80,29 @@ public class GcBasicPackingTest extends GcTestCase {
}
@Theory
+ public void testPack2Commits_noPackFolder(boolean aggressive) throws Exception {
+ File packDir = repo.getObjectDatabase().getPackDirectory();
+ assertTrue(packDir.delete());
+
+ BranchBuilder bb = tr.branch("refs/heads/master");
+ bb.commit().add("A", "A").add("B", "B").create();
+ bb.commit().add("A", "A2").add("B", "B2").create();
+
+ stats = gc.getStatistics();
+ assertEquals(8, stats.numberOfLooseObjects);
+ assertEquals(0, stats.numberOfPackedObjects);
+ configureGc(gc, aggressive);
+ gc.gc();
+ stats = gc.getStatistics();
+ assertEquals(0, stats.numberOfLooseObjects);
+ assertEquals(8, stats.numberOfPackedObjects);
+ assertEquals(1, stats.numberOfPackFiles);
+ assertEquals(2, stats.numberOfBitmaps);
+
+ assertTrue(packDir.exists());
+ }
+
+ @Theory
public void testPackAllObjectsInOnePack(boolean aggressive)
throws Exception {
tr.branch("refs/heads/master").commit().add("A", "A").add("B", "B")