summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorIvan Frade <ifrade@google.com>2023-11-08 17:48:08 -0500
committerIvan Frade <ifrade@google.com>2023-11-08 17:48:08 -0500
commit7ac2d257362120d8813c1ddc069afb873afe0540 (patch)
tree92478b4e31cbae13a500aa8771846596faed1b17 /org.eclipse.jgit
parent3937300f3eb4dd557ec2d195f21793f737d6cb4e (diff)
downloadjgit-7ac2d257362120d8813c1ddc069afb873afe0540.tar.gz
jgit-7ac2d257362120d8813c1ddc069afb873afe0540.zip
Revert "Optimise Git protocol v2 `ref-prefix` scanning"
This reverts commit 3937300f3eb4dd557ec2d195f21793f737d6cb4e. Reason for revert: This kills performance on the DFS side, that relies on loading the minimal amount of refs and reftables for quick prefix searches. Reverting as a safe option to keep master in good performance until we decide how to reintroduce this change. Change-Id: I7b1a3f900d9c78ce95cf0972abb50b6becfe3bb1
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java
index f3726868cb..9e05a39731 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java
@@ -474,9 +474,11 @@ public abstract class RefDatabase {
*/
@NonNull
public List<Ref> getRefsByPrefix(String... prefixes) throws IOException {
- return getRefsByPrefix(ALL).parallelStream().filter(
- ref -> Stream.of(prefixes).anyMatch(ref.getName()::startsWith))
- .collect(Collectors.toUnmodifiableList());
+ List<Ref> result = new ArrayList<>();
+ for (String prefix : prefixes) {
+ result.addAll(getRefsByPrefix(prefix));
+ }
+ return Collections.unmodifiableList(result);
}