From 7ac2d257362120d8813c1ddc069afb873afe0540 Mon Sep 17 00:00:00 2001 From: Ivan Frade Date: Wed, 8 Nov 2023 17:48:08 -0500 Subject: 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 --- org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'org.eclipse.jgit') 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 getRefsByPrefix(String... prefixes) throws IOException { - return getRefsByPrefix(ALL).parallelStream().filter( - ref -> Stream.of(prefixes).anyMatch(ref.getName()::startsWith)) - .collect(Collectors.toUnmodifiableList()); + List result = new ArrayList<>(); + for (String prefix : prefixes) { + result.addAll(getRefsByPrefix(prefix)); + } + return Collections.unmodifiableList(result); } -- cgit v1.2.3