HackPushNegotiateHook: Avoid RefDatabase#getRefs

Change-Id: I7682d55fa72674f3ebdf1e5758f6100f0016d4a3
This commit is contained in:
Dave Borowitz
2019-01-04 16:23:50 -08:00
parent adc087bf8e
commit 1acab02049

View File

@@ -14,7 +14,7 @@
package com.google.gerrit.server.git.receive;
import static org.eclipse.jgit.lib.RefDatabase.ALL;
import static java.util.stream.Collectors.toMap;
import com.google.common.collect.Sets;
import com.google.common.flogger.FluentLogger;
@@ -78,7 +78,12 @@ public class HackPushNegotiateHook implements AdvertiseRefsHook {
Map<String, Ref> r = rp.getAdvertisedRefs();
if (r == null) {
try {
r = rp.getRepository().getRefDatabase().getRefs(ALL);
r =
rp.getRepository()
.getRefDatabase()
.getRefs()
.stream()
.collect(toMap(Ref::getName, x -> x));
} catch (ServiceMayNotContinueException e) {
throw e;
} catch (IOException e) {