diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-03-20 13:54:10 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-03-20 14:10:30 +0100 |
commit | 534ede2d8143093110ff9f20ff9b510c690db8d1 (patch) | |
tree | bf5008eccf7eeb8c681ddbe12366d8141042f7f9 /org.eclipse.jgit | |
parent | 2b64345f53d48badb8523c1d3536522af4851315 (diff) | |
download | jgit-534ede2d8143093110ff9f20ff9b510c690db8d1.tar.gz jgit-534ede2d8143093110ff9f20ff9b510c690db8d1.zip |
Fix GC to delete empty fanout directories after repacking
The prune method did not delete empty fanout directories when loose
objects moved to a new pack file but only when loose unreferenced
objects were pruned.
Change-Id: Ia068f4914c54d9cf9f40b75e8ea50759402b5000
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java | 7 |
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 1b62c14dd3..092bd6da8c 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 @@ -545,9 +545,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(); |