diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-27 09:38:30 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-27 09:38:42 +0100 |
commit | 5cd485e5dda41d2ef06226a692c64f1aa221eb25 (patch) | |
tree | 134a5c1d050d68d04998532ef92ca9b265bec720 /org.eclipse.jgit.test | |
parent | e2663a8b85cf92f6a84d72834257243a84066e9d (diff) | |
parent | d1801402fee871610e983846225afd6339ce8ffd (diff) | |
download | jgit-5cd485e5dda41d2ef06226a692c64f1aa221eb25.tar.gz jgit-5cd485e5dda41d2ef06226a692c64f1aa221eb25.zip |
Merge branch 'stable-5.8' into stable-5.9
* stable-5.8:
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: I70b399eb3df02aa2fb112e86e844cf5a0daa5515
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/file/GcOrphanFilesTest.java | 20 |
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()); |