diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2018-08-27 01:20:31 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-08-27 09:12:14 +0200 |
commit | ddf56d6f85b6d33aba186d1c279b33cc311585c4 (patch) | |
tree | 03a15b6b6e8a58eff6b2d26b4bb0f946a62c7407 | |
parent | 8ab89ef066f91a7d39b705f4e61498f37291ffab (diff) | |
download | jgit-ddf56d6f85b6d33aba186d1c279b33cc311585c4.tar.gz jgit-ddf56d6f85b6d33aba186d1c279b33cc311585c4.zip |
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 <matthias.sohn@sap.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java | 3 |
1 files changed, 3 insertions, 0 deletions
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<Path> stream = Files.newDirectoryStream(packDir, "gc_*_tmp")) { //$NON-NLS-1$ stream.forEach(t -> { |