diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-08-27 17:05:23 +0900 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-08-27 21:12:59 +0200 |
commit | 4c77f62ccf97399a27f87d48a36928d662d7138a (patch) | |
tree | 79703647f47de2fa2b36d2c99f5902461868b692 | |
parent | cf60f26d26db2dc4f2d46264d5417e51c4e05c91 (diff) | |
parent | ddf56d6f85b6d33aba186d1c279b33cc311585c4 (diff) | |
download | jgit-4c77f62ccf97399a27f87d48a36928d662d7138a.tar.gz jgit-4c77f62ccf97399a27f87d48a36928d662d7138a.zip |
Merge branch 'stable-5.0'
* stable-5.0:
Fix NoSuchFileException in GC.deleteTempPacksIdx()
Fix NoSuchFileException during directory cleanup in RefDirectory
Change-Id: I35bd4bcbeac2430f674ccb6b947ac3776cec8a82
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java | 3 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java | 2 |
2 files changed, 4 insertions, 1 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 dbf8eb7804..ed32c638ec 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 @@ -997,6 +997,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 -> { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java index 9b2865d85a..6a18df86e2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java @@ -1287,7 +1287,7 @@ public class RefDirectory extends RefDatabase { File dir = file.getParentFile(); for (int i = 0; i < depth; ++i) { try { - Files.delete(dir.toPath()); + Files.deleteIfExists(dir.toPath()); } catch (DirectoryNotEmptyException e) { // Don't log; normal case when there are other refs with the // same prefix |