summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-11-27 00:40:00 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2020-11-27 00:40:26 +0100
commit95846863cbb929d2433d7a38151c2c7aebedafb0 (patch)
tree783bf1f58584275b983f80e59d65c0d4aa644d8e /org.eclipse.jgit.test
parentffe4616b5fff3772a26b8d9c56e50402d9563eac (diff)
parenta74c0cd333c11658afac2fd931f02bf6e1909153 (diff)
downloadjgit-95846863cbb929d2433d7a38151c2c7aebedafb0.tar.gz
jgit-95846863cbb929d2433d7a38151c2c7aebedafb0.zip
Merge branch 'stable-5.4' into stable-5.5
* stable-5.4: 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: Icc34f809a3bb019d8d640b9bdb71363e617942e2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-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.java24
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StatsTest.java1
3 files changed, 22 insertions, 4 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 5a5ae1d7a3..858f5b905a 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 79d72c56d0..e54c4ad458 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,11 +57,15 @@ public class GcOrphanFilesTest extends GcTestCase {
private final static String BITMAP_File_1 = PACK + "-1.bitmap";
- private final static String IDX_File_2 = PACK + "-2.idx";
+ private static final String BITMAP_File_2 = PACK + "-2.bitmap";
+
+ private static final String IDX_File_2 = PACK + "-2.idx";
private final static String IDX_File_malformed = PACK + "-1234idx";
- private final static String PACK_File_2 = PACK + "-2.pack";
+ private static final String KEEP_File_2 = PACK + "-2.keep";
+
+ private static final String PACK_File_2 = PACK + "-2.pack";
private final static 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 {