]> source.dussan.org Git - jgit.git/commitdiff
BatchRefUpdate: Don't use deprecated RefDatabase#getRefs(String) 25/122625/3
authorDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 15 May 2018 00:56:32 +0000 (09:56 +0900)
committerJonathan Nieder <jrn@google.com>
Tue, 15 May 2018 22:02:39 +0000 (18:02 -0400)
Change-Id: I672c9cfe221ddc4acbde7a8040bd6ba83b16626e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java

index 5e1755370698b4c571e8e539e1ea696bc337f8e0..925b6beadb38a719843d0416d9050d26daabe4be 100644 (file)
@@ -46,6 +46,7 @@ package org.eclipse.jgit.lib;
 
 import static org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED;
 import static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_OTHER_REASON;
+import static java.util.stream.Collectors.toCollection;
 
 import java.io.IOException;
 import java.text.MessageFormat;
@@ -528,8 +529,9 @@ public class BatchRefUpdate {
                }
                if (!commands2.isEmpty()) {
                        // What part of the name space is already taken
-                       Collection<String> takenNames = new HashSet<>(refdb.getRefs(
-                                       RefDatabase.ALL).keySet());
+                       Collection<String> takenNames = refdb.getRefs().stream()
+                                       .map(Ref::getName)
+                                       .collect(toCollection(HashSet::new));
                        Collection<String> takenPrefixes = getTakenPrefixes(takenNames);
 
                        // Now to the update that may require more room in the name space