summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2018-08-19 20:48:06 +0200
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-09-11 08:26:52 +0900
commit94fad4412ae151c0a71150e8b83edc0ecd10adf3 (patch)
treef267152d76a01f5206dc9e710816af9b00117db6
parent6fe4505b2a753173ff9708c2c71cb833aaacf016 (diff)
downloadjgit-94fad4412ae151c0a71150e8b83edc0ecd10adf3.tar.gz
jgit-94fad4412ae151c0a71150e8b83edc0ecd10adf3.zip
Suppress warning for trying to delete non-empty directory
This is actually a fairly common occurrence; deleting the parent directories can work only if the file deleted was the last one in the directory. Bug: 537872 Change-Id: I86d1d45e1e2631332025ff24af8dfd46c9725711 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> (cherry picked from commit d9e767b431eae7978613cc8e0ade7467ec04376c) Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java5
1 files changed, 5 insertions, 0 deletions
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 48fdf8119f..d16ca7095f 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
@@ -63,6 +63,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.Files;
import java.security.DigestInputStream;
import java.security.MessageDigest;
@@ -1093,6 +1094,10 @@ public class RefDirectory extends RefDatabase {
for (int i = 0; i < depth; ++i) {
try {
Files.delete(dir.toPath());
+ } catch (DirectoryNotEmptyException e) {
+ // Don't log; normal case when there are other refs with the
+ // same prefix
+ break;
} catch (IOException e) {
LOG.warn("Unable to remove path {}", dir, e);
break;