summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-11-27 01:01:17 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2020-11-27 01:01:31 +0100
commit480b00f1c799bbd09bf747dca88c23a4844931cd (patch)
tree927b9f1204f9dd770a02963f590c703d129cf0ab /org.eclipse.jgit.test/tst
parent916b367c27af8d491d5a385ad7cb140fa27e6594 (diff)
parent95846863cbb929d2433d7a38151c2c7aebedafb0 (diff)
downloadjgit-480b00f1c799bbd09bf747dca88c23a4844931cd.tar.gz
jgit-480b00f1c799bbd09bf747dca88c23a4844931cd.zip
Merge branch 'stable-5.5' into stable-5.6
* stable-5.5: Prepare 5.3.9-SNAPSHOT builds JGit v5.3.8.202011260953-r Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock Update API warning filters Remove unused imports Change-Id: I00c8ddad0059a20a978743dfb7ad1b513dc7fef6 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/dfs/DfsGarbageCollectorTest.java1
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java20
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java1
3 files changed, 20 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
index cfc275a7de..1d7e283f28 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
@@ -19,7 +19,6 @@ import java.util.Collections;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource;
-import org.eclipse.jgit.internal.storage.dfs.DfsRefDatabase;
import org.eclipse.jgit.internal.storage.reftable.RefCursor;
import org.eclipse.jgit.internal.storage.reftable.ReftableConfig;
import org.eclipse.jgit.internal.storage.reftable.ReftableReader;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java
index 78b830e649..bbbe3b9657 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java
@@ -57,10 +57,14 @@ public class GcOrphanFilesTest extends GcTestCase {
private static final String BITMAP_File_1 = PACK + "-1.bitmap";
+ private static final String BITMAP_File_2 = PACK + "-2.bitmap";
+
private static final String IDX_File_2 = PACK + "-2.idx";
private static final String IDX_File_malformed = PACK + "-1234idx";
+ private static final String KEEP_File_2 = PACK + "-2.keep";
+
private static final String PACK_File_2 = PACK + "-2.pack";
private static final String PACK_File_3 = PACK + "-3.pack";
@@ -105,6 +109,22 @@ public class GcOrphanFilesTest extends GcTestCase {
assertTrue(new File(packDir, IDX_File_malformed).exists());
}
+ @Test
+ public void keepPreventsDeletionOfIndexFilesForMissingPackFile()
+ throws Exception {
+ createFileInPackFolder(BITMAP_File_1);
+ createFileInPackFolder(IDX_File_2);
+ createFileInPackFolder(BITMAP_File_2);
+ createFileInPackFolder(KEEP_File_2);
+ createFileInPackFolder(PACK_File_3);
+ gc.gc();
+ assertFalse(new File(packDir, BITMAP_File_1).exists());
+ assertTrue(new File(packDir, BITMAP_File_2).exists());
+ assertTrue(new File(packDir, IDX_File_2).exists());
+ assertTrue(new File(packDir, KEEP_File_2).exists());
+ assertTrue(new File(packDir, PACK_File_3).exists());
+ }
+
private void createFileInPackFolder(String fileName) throws IOException {
if (!packDir.exists() || !packDir.isDirectory()) {
assertTrue(packDir.mkdirs());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java
index 8b253828c4..0303bb4f7c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java
@@ -45,7 +45,6 @@ package org.eclipse.jgit.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import org.eclipse.jgit.util.Stats;
import org.junit.Test;
public class StatsTest {