DfsPackDescription: New method getTotalFileSize() In code setting up the compact, we need to iterate over the extensions and adding their sizes. DfsPackDescription itself is a better place for this functionality. Add a getTotalFileSize() method returning the accumulated size of all extensions in the pack. Change-Id: Ief378305122ef2e74367ff44d187ee256a6a6964
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackDescription.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackDescription.java index d4fe566..7a3c139 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackDescription.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackDescription.java
@@ -367,6 +367,19 @@ public long getFileSize(PackExt ext) { } /** + * Get total size of the pack, including indexes + * + * @return the size of the pack and all its extensions + */ + public long getTotalFileSize() { + long result = 0; + for (long sz : sizeMap) { + result += sz; + } + return result; + } + + /** * Get blockSize of the file, in bytes. * * @param ext