]> source.dussan.org Git - jgit.git/commitdiff
Replace deprecated org.eclipse.jgit.lib.RefDatabase.getRefs 45/190245/4
authorFabio Ponciroli <ponch78@gmail.com>
Tue, 1 Feb 2022 15:48:14 +0000 (16:48 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 2 Feb 2022 21:43:19 +0000 (22:43 +0100)
The method has been deprecated since 5.0.
Use getRefsByPrefix instead.

Bug: 534731
Change-Id: I5f1cfc1fd5ae49dc7a4ed3e039f23ed785d674f6

org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/BatchRefUpdateTest.java

index c0259f87f587c1dcbdf3533063b6326b20aa5c72..daf4382719acb4fe0bb8db77f4a64c25935f16f5 100644 (file)
@@ -42,6 +42,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.Predicate;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 import org.eclipse.jgit.events.ListenerHandle;
 import org.eclipse.jgit.events.RefsChangedListener;
@@ -1191,7 +1193,8 @@ public class BatchRefUpdateTest extends LocalDiskRepositoryTestCase {
                }
 
                Map<String, Ref> refs = diskRepo.getRefDatabase()
-                               .getRefs(RefDatabase.ALL);
+                               .getRefsByPrefix(RefDatabase.ALL).stream()
+                               .collect(Collectors.toMap(Ref::getName, Function.identity()));
                Ref actualHead = refs.remove(Constants.HEAD);
                if (actualHead != null) {
                        String actualLeafName = actualHead.getLeaf().getName();