diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java index 304a93128..8a63b8ba7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java @@ -486,7 +486,12 @@ public class DfsGarbageCollector { return newPackDesc; } - /** @return statistics corresponding to the {@link #getNewPacks()}. */ + /** + * @return statistics corresponding to the {@link #getNewPacks()}. + * + *

The elements can be null if the stat is not available for the pack + * file. + */ public List getNewPackStatistics() { return newPackStats; } @@ -637,7 +642,6 @@ public class DfsGarbageCollector { ProgressMonitor pm, long estimatedPackSize) throws IOException { DfsPackDescription pack = repo.getObjectDatabase().newPack(source, estimatedPackSize); - newPackDesc.add(pack); if (source == GC && reftableConfig != null) { writeReftable(pack); @@ -671,6 +675,7 @@ public class DfsGarbageCollector { PackStatistics stats = pw.getStatistics(); pack.setPackStats(stats); pack.setLastModified(startTimeMillis); + newPackDesc.add(pack); newPackStats.add(stats); newPackObj.add(pw.getObjectSet()); return pack; @@ -680,6 +685,7 @@ public class DfsGarbageCollector { if (reftableConfig != null) { DfsPackDescription pack = objdb.newPack(GC); newPackDesc.add(pack); + newPackStats.add(null); writeReftable(pack); } } 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 99663eb73..14f182c93 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 @@ -350,9 +350,13 @@ public class DfsPackCompactor { : Collections.emptyList(); } - /** @return statistics corresponding to the {@link #getNewPacks()}. */ + /** + * @return statistics corresponding to the {@link #getNewPacks()}. + * + *

The element may be null if the stat is not available. + */ public List getNewPackStatistics() { - return newStats != null + return outDesc != null ? Collections.singletonList(newStats) : Collections.emptyList(); }