summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java7
1 files changed, 5 insertions, 2 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 015d44e87f..e1ba130041 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
@@ -549,9 +549,12 @@ public class GC {
pm.update(1);
if (d.length() != 2)
continue;
- File[] entries = new File(objects, d).listFiles();
- if (entries == null)
+ File dir = new File(objects, d);
+ File[] entries = dir.listFiles();
+ if (entries == null || entries.length == 0) {
+ FileUtils.delete(dir, FileUtils.IGNORE_ERRORS);
continue;
+ }
for (File f : entries) {
checkCancelled();
String fName = f.getName();