summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java2
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