From: Matthias Sohn Date: Sun, 26 Aug 2018 23:20:31 +0000 (+0200) Subject: Fix NoSuchFileException in GC.deleteTempPacksIdx() X-Git-Tag: v5.1.0.201808281540-m3~3^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F95%2F128095%2F2;p=jgit.git Fix NoSuchFileException in GC.deleteTempPacksIdx() This exception is thrown in GC.deleteTempPacksIdx() if the repository has no packs. Bug: 538286 Change-Id: Ieb482be751226baf0843068a0f847e0cdc6e0cb6 Signed-off-by: Matthias Sohn --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java index 3fab484f29..de1b8c1f8b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java @@ -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 stream = Files.newDirectoryStream(packDir, "gc_*_tmp")) { //$NON-NLS-1$ stream.forEach(t -> {