summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BitmappedReachabilityChecker.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PedestrianReachabilityChecker.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java17
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java7
4 files changed, 21 insertions, 11 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BitmappedReachabilityChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BitmappedReachabilityChecker.java
index ab453433d8..6e510f677b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BitmappedReachabilityChecker.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BitmappedReachabilityChecker.java
@@ -55,10 +55,8 @@ import org.eclipse.jgit.lib.NullProgressMonitor;
/**
* Checks the reachability using bitmaps.
- *
- * @since 5.4
*/
-public class BitmappedReachabilityChecker implements ReachabilityChecker {
+class BitmappedReachabilityChecker implements ReachabilityChecker {
private final RevWalk walk;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PedestrianReachabilityChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PedestrianReachabilityChecker.java
index 4012a45d3c..bba3c5cff3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PedestrianReachabilityChecker.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PedestrianReachabilityChecker.java
@@ -52,10 +52,8 @@ import org.eclipse.jgit.errors.MissingObjectException;
/**
* Checks the reachability walking the graph from the starters towards the
* target.
- *
- * @since 5.4
*/
-public class PedestrianReachabilityChecker implements ReachabilityChecker {
+class PedestrianReachabilityChecker implements ReachabilityChecker {
private final boolean topoSort;
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 f12eb2ff86..80fc81073c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
@@ -250,6 +250,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.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index 3ed9886c45..6217d2a0e9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -106,10 +106,8 @@ import org.eclipse.jgit.lib.RefDatabase;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.AsyncRevObjectQueue;
import org.eclipse.jgit.revwalk.BitmapWalker;
-import org.eclipse.jgit.revwalk.BitmappedReachabilityChecker;
import org.eclipse.jgit.revwalk.DepthWalk;
import org.eclipse.jgit.revwalk.ObjectWalk;
-import org.eclipse.jgit.revwalk.PedestrianReachabilityChecker;
import org.eclipse.jgit.revwalk.ReachabilityChecker;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevFlag;
@@ -1909,9 +1907,8 @@ public class UploadPack {
}
// All wants are commits, we can use ReachabilityChecker
- ReachabilityChecker reachabilityChecker = repoHasBitmaps
- ? new BitmappedReachabilityChecker(walk)
- : new PedestrianReachabilityChecker(true, walk);
+ ReachabilityChecker reachabilityChecker = walk
+ .createReachabilityChecker();
List<RevCommit> starters = objectIdsToRevCommits(walk,
reachableFrom);