Replace deprecated org.eclipse.jgit.lib.RefDatabase.getRefs

The method has been deprecated since 5.0.
Use getRefsByPrefix instead.

Bug: 534731
Change-Id: I5f1cfc1fd5ae49dc7a4ed3e039f23ed785d674f6
This commit is contained in:
Fabio Ponciroli 2022-02-01 16:48:14 +01:00 committed by Matthias Sohn
parent 035d24097d
commit e84988f2a5
1 changed files with 4 additions and 1 deletions

View File

@ -42,6 +42,8 @@
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 @@ private void assertRefs(Object... args) throws IOException {
}
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();