Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
index 0a43e8fb1a..f50d189ce5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
@@ -72,6 +72,7 @@ import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.filter.RevFilter;
import org.eclipse.jgit.treewalk.filter.TreeFilter;
+import org.eclipse.jgit.util.References;
/**
* Walks a commit graph and produces the matching commits in order.
@@ -250,6 +251,23 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
}
/**
+ * Get a reachability checker for commits over this revwalk.
+ *
+ * @return the most efficient reachability checker for this repository.
+ * @throws IOException
+ * if it cannot open any of the underlying indices.
+ *
+ * @since 5.4
+ */
+ public ReachabilityChecker createReachabilityChecker() throws IOException {
+ if (reader.getBitmapIndex() != null) {
+ return new BitmappedReachabilityChecker(this);
+ }
+
+ return new PedestrianReachabilityChecker(true, this);
+ }
+
+ /**
* {@inheritDoc}
* <p>
* Release any resources used by this walker's reader.
@@ -416,9 +434,11 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
markStart(tip);
markStart(base);
RevCommit mergeBase;
- while ((mergeBase = next()) != null)
- if (mergeBase == base)
+ while ((mergeBase = next()) != null) {
+ if (References.isSameObject(mergeBase, base)) {
return true;
+ }
+ }
return false;
} finally {
filter = oldRF;
@@ -506,7 +526,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
if (sorting.size() > 1)
sorting.remove(RevSort.NONE);
- else if (sorting.size() == 0)
+ else if (sorting.isEmpty())
sorting.add(RevSort.NONE);
}

Back to the top