HackPushNegotiateHook: Avoid RefDatabase#getRefs
Change-Id: I7682d55fa72674f3ebdf1e5758f6100f0016d4a3
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.git.receive;
|
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.collect.Sets;
|
||||||
import com.google.common.flogger.FluentLogger;
|
import com.google.common.flogger.FluentLogger;
|
||||||
@@ -78,7 +78,12 @@ public class HackPushNegotiateHook implements AdvertiseRefsHook {
|
|||||||
Map<String, Ref> r = rp.getAdvertisedRefs();
|
Map<String, Ref> r = rp.getAdvertisedRefs();
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
try {
|
try {
|
||||||
r = rp.getRepository().getRefDatabase().getRefs(ALL);
|
r =
|
||||||
|
rp.getRepository()
|
||||||
|
.getRefDatabase()
|
||||||
|
.getRefs()
|
||||||
|
.stream()
|
||||||
|
.collect(toMap(Ref::getName, x -> x));
|
||||||
} catch (ServiceMayNotContinueException e) {
|
} catch (ServiceMayNotContinueException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user