diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java index 509ee6111..9ab62d3c2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java @@ -63,6 +63,7 @@ import org.eclipse.jgit.internal.storage.file.BitmapIndexImpl; import org.eclipse.jgit.internal.storage.file.PackBitmapIndex; import org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder; import org.eclipse.jgit.internal.storage.file.PackBitmapIndexRemapper; +import org.eclipse.jgit.internal.storage.pack.PackWriterBitmapWalker.AddUnseenToBitmapFilter; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; @@ -262,7 +263,7 @@ class PackWriterBitmapPreparer { BitmapBuilder fullBitmap = commitBitmapIndex.newBitmapBuilder(); rw.reset(); rw.markStart(c); - rw.setRevFilter(PackWriterBitmapWalker.newRevFilter( + rw.setRevFilter(new AddUnseenToBitmapFilter( selectionHelper.reusedCommitsBitmap, fullBitmap)); while (rw.next() != null) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapWalker.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapWalker.java index 262e5c4a1..ccee1893f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapWalker.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapWalker.java @@ -110,8 +110,12 @@ final class PackWriterBitmapWalker { } if (marked) { - RevFilter filter = newRevFilter(seen, bitmapResult); - walker.setRevFilter(filter); + if (seen == null) { + walker.setRevFilter(new AddToBitmapFilter(bitmapResult)); + } else { + walker.setRevFilter( + new AddUnseenToBitmapFilter(seen, bitmapResult)); + } while (walker.next() != null) { // Iterate through all of the commits. The BitmapRevFilter does @@ -141,13 +145,6 @@ final class PackWriterBitmapWalker { walker.reset(); } - static RevFilter newRevFilter(BitmapBuilder seen, BitmapBuilder bitmapResult) { - if (seen != null) { - return new AddUnseenToBitmapFilter(seen, bitmapResult); - } - return new AddToBitmapFilter(bitmapResult); - } - /** * A RevFilter that adds the visited commits to {@code bitmap} as a side * effect. @@ -158,7 +155,7 @@ final class PackWriterBitmapWalker { * have to visit its ancestors. This ensures the walk is very short if * there is good bitmap coverage. */ - private static class AddToBitmapFilter extends RevFilter { + static class AddToBitmapFilter extends RevFilter { private final BitmapBuilder bitmap; AddToBitmapFilter(BitmapBuilder bitmap) { @@ -209,7 +206,7 @@ final class PackWriterBitmapWalker { * encountered, that commit and its parents will be marked with the SEEN * flag to prevent the walk from visiting its ancestors. */ - private static class AddUnseenToBitmapFilter extends RevFilter { + static class AddUnseenToBitmapFilter extends RevFilter { private final BitmapBuilder seen; private final BitmapBuilder bitmap;