diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-26 15:37:19 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-26 15:37:19 +0100 |
commit | 3f85d3b75c559bd44b333a2ae66ceb6b93022000 (patch) | |
tree | c55f9cce3207e1fc421d18f7446f7923872dfb69 /org.eclipse.jgit.test | |
parent | 003e4cfc237a2bcf9349665e3578bead06c120c3 (diff) | |
parent | 65598b95161e3766c31bddeb45bc5d628b6d90fd (diff) | |
download | jgit-3f85d3b75c559bd44b333a2ae66ceb6b93022000.tar.gz jgit-3f85d3b75c559bd44b333a2ae66ceb6b93022000.zip |
Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
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: Id9386846a202b5ae98dd602744963f8897ddaa8c
Diffstat (limited to 'org.eclipse.jgit.test')
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 bfa30d5b4b..b5c73c2b02 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 { |