]> source.dussan.org Git - jgit.git/commitdiff
Align PackStatistics and DfsPackDescription list length 73/110473/1
authorMasaya Suzuki <masayasuzuki@google.com>
Fri, 20 Oct 2017 19:18:16 +0000 (12:18 -0700)
committerMasaya Suzuki <masayasuzuki@google.com>
Fri, 20 Oct 2017 19:28:34 +0000 (12:28 -0700)
Without this the caller cannot tell which PackStatistics is for which
pack file.

Change-Id: Ifa530f8bc82459611ae694c0a0d111daec3e08f3
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java

index 304a93128f72c7c3abf96a402c8f5ea05487f92f..8a63b8ba74c4efc979c9a9dbf71b38c1738acf74 100644 (file)
@@ -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);
                }
        }
index 99663eb7383c9a257c0494a184d81547ad4f813e..14f182c93fd0da00e69f614f30455b584bf1fe43 100644 (file)
@@ -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();
        }