summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-11-27 10:58:43 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2020-11-27 10:59:01 +0100
commit4f2065d145c3fa3f8ad3de28af3ee5dfeb74c765 (patch)
treec32f15fc0bc553a1cd76e21f4ca96f0e61978c99 /org.eclipse.jgit.test/tst/org
parent9ebbfe93bb3ba0ea170d330fe227f1d8182d7d64 (diff)
parentd4fe93f55bcdf3115a53ac69c1594dd7799e2453 (diff)
downloadjgit-4f2065d145c3fa3f8ad3de28af3ee5dfeb74c765.tar.gz
jgit-4f2065d145c3fa3f8ad3de28af3ee5dfeb74c765.zip
Merge branch 'stable-5.10'
* stable-5.10: Remove unused imports Silence API warnings Remove erraneously merged source features 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 PacketLineIn: ensure that END != DELIM Update API warning filters Remove unused imports Change-Id: I25f50c3807a4e6b22a264320ea7ed3758e2a75ec Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcOrphanFilesTest.java20
1 files changed, 20 insertions, 0 deletions
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 84d364b985..c5c316d357 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
@@ -24,10 +24,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";
@@ -72,6 +76,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());