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
This commit is contained in:
Colby Ranger 2013-09-16 11:56:02 -07:00
parent 02bd26e5a6
commit 7dc6c553c0
1 changed files with 7 additions and 1 deletions

View File

@ -220,8 +220,14 @@ public void compact(ProgressMonitor pm) throws IOException {
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);