diff options
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java index 9c84fb7ad2..076df18800 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java @@ -145,7 +145,7 @@ final class DeltaTask implements Callable<Object> { } s = i = topPaths.get(nextTop++).slice.endIndex; } else { - w += list[i++].getWeight(); + w += getAdjustedWeight(list[i++]); } } @@ -180,8 +180,8 @@ final class DeltaTask implements Callable<Object> { threads); int cp = beginIndex; int ch = list[cp].getPathHash(); - long cw = list[cp].getWeight(); - totalWeight = list[cp].getWeight(); + long cw = getAdjustedWeight(list[cp]); + totalWeight = cw; for (int i = cp + 1; i < endIndex; i++) { ObjectToPack o = list[i]; @@ -206,11 +206,9 @@ final class DeltaTask implements Callable<Object> { ch = o.getPathHash(); cw = 0; } - if (o.isEdge() || o.doNotAttemptDelta()) { - continue; - } - cw += o.getWeight(); - totalWeight += o.getWeight(); + int weight = getAdjustedWeight(o); + cw += weight; + totalWeight += weight; } // Sort by starting index to identify gaps later. @@ -228,6 +226,15 @@ final class DeltaTask implements Callable<Object> { } } + private static int getAdjustedWeight(ObjectToPack o) { + // Edge objects and those with reused deltas do not need to be + // compressed. For compression calculations, ignore their weights. + if (o.isEdge() || o.doNotAttemptDelta()) { + return 0; + } + return o.getWeight(); + } + static final class WeightedPath implements Comparable<WeightedPath> { final long weight; final Slice slice; |