diff options
author | Zhen Chen <czhen@google.com> | 2017-05-03 14:56:40 -0700 |
---|---|---|
committer | Zhen Chen <czhen@google.com> | 2017-05-03 15:02:33 -0700 |
commit | 8f7d0a4fbe8862e71d900b0585c97407037ef9a5 (patch) | |
tree | d285a818e11ca509e4118acf221519433d17235c | |
parent | d377a885a98d4a6281b3edd0aa6a0c610cf5e1a6 (diff) | |
download | jgit-8f7d0a4fbe8862e71d900b0585c97407037ef9a5.tar.gz jgit-8f7d0a4fbe8862e71d900b0585c97407037ef9a5.zip |
Reset ObjectWalker when it starts a new walk
The ObjectWalker in PackWriterBitmapWalker needs to be reset whenever it
starts a new walk. Move this responsibility from the caller to the
method when the new walk starts.
Change-Id: Ib66003be1b5bdc80f46b9bbbb17d45e616714912
Signed-off-by: Zhen Chen <czhen@google.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java | 7 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapWalker.java | 11 |
2 files changed, 7 insertions, 11 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index 93dbee3e79..8810a9f608 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -1874,7 +1874,6 @@ public class PackWriter implements AutoCloseable { throws MissingObjectException, IncorrectObjectTypeException, IOException { BitmapBuilder haveBitmap = bitmapWalker.findObjects(have, null, true); - bitmapWalker.reset(); BitmapBuilder wantBitmap = bitmapWalker.findObjects(want, haveBitmap, false); BitmapBuilder needBitmap = wantBitmap.andNot(haveBitmap); @@ -2079,11 +2078,9 @@ public class PackWriter implements AutoCloseable { PackWriterBitmapWalker walker = bitmapPreparer.newBitmapWalker(); AnyObjectId last = null; for (PackWriterBitmapPreparer.BitmapCommit cmit : selectedCommits) { - if (cmit.isReuseWalker()) - walker.reset(); - else + if (!cmit.isReuseWalker()) { walker = bitmapPreparer.newBitmapWalker(); - + } BitmapBuilder bitmap = walker.findObjects( Collections.singleton(cmit), null, false); 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 34762495cf..a5c3b71eb2 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 @@ -84,7 +84,8 @@ final class PackWriterBitmapWalker { return countOfBitmapIndexMisses; } - BitmapBuilder findObjects(Iterable<? extends ObjectId> start, BitmapBuilder seen, boolean ignoreMissing) + BitmapBuilder findObjects(Iterable<? extends ObjectId> start, BitmapBuilder seen, + boolean ignoreMissing) throws MissingObjectException, IncorrectObjectTypeException, IOException { if (!ignoreMissing) { @@ -132,9 +133,11 @@ final class PackWriterBitmapWalker { return result; } - private BitmapBuilder findObjectsWalk(Iterable<? extends ObjectId> start, BitmapBuilder seen, boolean ignoreMissingStart) + private BitmapBuilder findObjectsWalk(Iterable<? extends ObjectId> start, BitmapBuilder seen, + boolean ignoreMissingStart) throws MissingObjectException, IncorrectObjectTypeException, IOException { + walker.reset(); final BitmapBuilder bitmapResult = bitmapIndex.newBitmapBuilder(); for (ObjectId obj : start) { @@ -189,10 +192,6 @@ final class PackWriterBitmapWalker { return bitmapResult; } - void reset() { - walker.reset(); - } - /** * A RevFilter that adds the visited commits to {@code bitmap} as a side * effect. |