diff options
author | Masaya Suzuki <masayasuzuki@google.com> | 2017-10-20 12:18:16 -0700 |
---|---|---|
committer | Masaya Suzuki <masayasuzuki@google.com> | 2017-10-20 12:28:34 -0700 |
commit | 45837ff18923817887f62304926645689312274a (patch) | |
tree | 93c5b7ad374c9b07bd21e118fc6c618f56211893 /org.eclipse.jgit/src | |
parent | 7cd5d77ae37ad7febb6d6e7410da4e7b35348fce (diff) | |
download | jgit-45837ff18923817887f62304926645689312274a.tar.gz jgit-45837ff18923817887f62304926645689312274a.zip |
Align PackStatistics and DfsPackDescription list length
Without this the caller cannot tell which PackStatistics is for which
pack file.
Change-Id: Ifa530f8bc82459611ae694c0a0d111daec3e08f3
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java | 10 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java | 8 |
2 files changed, 14 insertions, 4 deletions
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 304a93128f..8a63b8ba74 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()}. + * + * <p>The elements can be null if the stat is not available for the pack + * file. + */ public List<PackStatistics> 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 99663eb738..14f182c93f 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()}. + * + * <p>The element may be null if the stat is not available. + */ public List<PackStatistics> getNewPackStatistics() { - return newStats != null + return outDesc != null ? Collections.singletonList(newStats) : Collections.emptyList(); } |