summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColby Ranger <cranger@google.com>2013-09-16 11:56:02 -0700
committerColby Ranger <cranger@google.com>2013-09-16 11:56:02 -0700
commit7dc6c553c02875991c6124ab02f0c0f72dae04b9 (patch)
tree38a770a6599238506b068c132c584ee2549cf401
parent02bd26e5a636fe2d9f128860530eda27ac35b334 (diff)
downloadjgit-7dc6c553c02875991c6124ab02f0c0f72dae04b9.tar.gz
jgit-7dc6c553c02875991c6124ab02f0c0f72dae04b9.zip
Remove unneeded packs when compacting with no new objects
Previously, the DfsPackCompactor exited without pruning the existing packs, when no new packs were created. Change-Id: I5e3b6f8c789706c7a982e6ae93cf7c3d4346797c
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java
index ea563926b2..83728842b7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java
@@ -220,8 +220,14 @@ public class DfsPackCompactor {
pw.setReuseDeltaCommits(false);
addObjectsToPack(pw, ctx, pm);
- if (pw.getObjectCount() == 0)
+ if (pw.getObjectCount() == 0) {
+ List<DfsPackDescription> remove = toPrune();
+ if (remove.size() > 0)
+ objdb.commitPack(
+ Collections.<DfsPackDescription>emptyList(),
+ remove);
return;
+ }
boolean rollback = true;
DfsPackDescription pack = objdb.newPack(COMPACT);