]> source.dussan.org Git - jgit.git/commitdiff
Fix NoSuchFileException in GC.deleteTempPacksIdx() 95/128095/2
authorMatthias Sohn <matthias.sohn@sap.com>
Sun, 26 Aug 2018 23:20:31 +0000 (01:20 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 27 Aug 2018 07:12:14 +0000 (09:12 +0200)
This exception is thrown in GC.deleteTempPacksIdx() if the repository
has no packs.

Bug: 538286
Change-Id: Ieb482be751226baf0843068a0f847e0cdc6e0cb6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

index 3fab484f29fbebcae9ea0112c0d64d8620a55747..de1b8c1f8b8c8c188fa1373665e79c968cfc883d 100644 (file)
@@ -996,6 +996,9 @@ public class GC {
        private void deleteTempPacksIdx() {
                Path packDir = repo.getObjectDatabase().getPackDirectory().toPath();
                Instant threshold = Instant.now().minus(1, ChronoUnit.DAYS);
+               if (!Files.exists(packDir)) {
+                       return;
+               }
                try (DirectoryStream<Path> stream =
                                Files.newDirectoryStream(packDir, "gc_*_tmp")) { //$NON-NLS-1$
                        stream.forEach(t -> {