diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsGarbageCollector.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsGarbageCollector.java index 76b36a416..40555dde1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsGarbageCollector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsGarbageCollector.java @@ -403,9 +403,6 @@ public class DfsGarbageCollector { PackWriter.Statistics stats = pw.getStatistics(); pack.setPackStats(stats); - pack.setFileSize(PACK, stats.getTotalBytes()); - pack.setObjectCount(stats.getTotalObjects()); - pack.setDeltaCount(stats.getTotalDeltas()); objectsPacked += stats.getTotalObjects(); newPackStats.add(stats); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackCompactor.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackCompactor.java index 904ba4efc..3f6a02214 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackCompactor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackCompactor.java @@ -283,20 +283,19 @@ public class DfsPackCompactor { pm.endTask(); } - private void writePack(DfsObjDatabase objdb, DfsPackDescription pack, + private static void writePack(DfsObjDatabase objdb, + DfsPackDescription pack, PackWriter pw, ProgressMonitor pm) throws IOException { DfsOutputStream out = objdb.writeFile(pack, PACK); try { - CountingOutputStream cnt = new CountingOutputStream(out); - pw.writePack(pm, pm, cnt); - pack.setObjectCount(pw.getObjectCount()); - pack.setFileSize(PACK, cnt.getCount()); + pw.writePack(pm, pm, out); } finally { out.close(); } } - private void writeIndex(DfsObjDatabase objdb, DfsPackDescription pack, + private static void writeIndex(DfsObjDatabase objdb, + DfsPackDescription pack, PackWriter pw) throws IOException { DfsOutputStream out = objdb.writeFile(pack, INDEX); try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java index 746a64aed..c4a531e7b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java @@ -43,6 +43,8 @@ package org.eclipse.jgit.storage.dfs; +import static org.eclipse.jgit.storage.pack.PackExt.PACK; + import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -248,6 +250,9 @@ public class DfsPackDescription implements Comparable { DfsPackDescription setPackStats(PackWriter.Statistics stats) { this.stats = stats; + setFileSize(PACK, stats.getTotalBytes()); + setObjectCount(stats.getTotalObjects()); + setDeltaCount(stats.getTotalDeltas()); return this; }