Browse Source

Use .addObject and .or instead of .add in AddToBitmapFilter

This is the caller that the BitmapBuilder.add method was designed
around.  Moving away from .add makes it more verbose but hopefully
clearer.

Change-Id: I57b1d7c1dc8fb800b242b76c606922b5aa36b9b2
stable-4.2
Jonathan Nieder 9 years ago
parent
commit
fd1ee636a2
  1. 20
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapWalker.java

20
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapWalker.java

@ -167,9 +167,17 @@ final class PackWriterBitmapWalker {
@Override
public final boolean include(RevWalk walker, RevCommit cmit) {
if (bitmap.add(cmit, Constants.OBJ_COMMIT)) {
Bitmap visitedBitmap;
if (bitmap.contains(cmit)) {
// already included
} else if ((visitedBitmap = bitmap.getBitmapIndex().getBitmap(cmit)) != null) {
bitmap.or(visitedBitmap);
} else {
bitmap.addObject(cmit, Constants.OBJ_COMMIT);
return true;
}
for (RevCommit p : cmit.getParents()) {
p.add(RevFlag.SEEN);
}
@ -212,9 +220,17 @@ final class PackWriterBitmapWalker {
@Override
public final boolean include(RevWalk walker, RevCommit cmit) {
if (!seen.contains(cmit) && bitmap.add(cmit, Constants.OBJ_COMMIT)) {
Bitmap visitedBitmap;
if (seen.contains(cmit) || bitmap.contains(cmit)) {
// already seen or included
} else if ((visitedBitmap = bitmap.getBitmapIndex().getBitmap(cmit)) != null) {
bitmap.or(visitedBitmap);
} else {
bitmap.addObject(cmit, Constants.OBJ_COMMIT);
return true;
}
for (RevCommit p : cmit.getParents()) {
p.add(RevFlag.SEEN);
}

Loading…
Cancel
Save