in src/main/java/com/googlesource/gerrit/plugins/replication/DestinationConfigParser.java [44:95]
public List<RemoteConfiguration> parseRemotes(Config config) throws ConfigInvalidException {
if (config.getSections().isEmpty()) {
logger.atWarning().log("Replication config does not exist or it's empty; not replicating");
return Collections.emptyList();
}
boolean defaultForceUpdate = config.getBoolean("gerrit", "defaultForceUpdate", false);
ImmutableList.Builder<RemoteConfiguration> confs = ImmutableList.builder();
for (RemoteConfig c : allRemotes(config)) {
if (c.getURIs().isEmpty()) {
continue;
}
if (!c.getFetchRefSpecs().isEmpty()) {
repLog.atInfo().log("Ignore '%s' endpoint: not a 'push' target", c.getName());
continue;
}
// If destination for push is not set assume equal to source.
for (RefSpec ref : c.getPushRefSpecs()) {
if (ref.getDestination() == null) {
ref.setDestination(ref.getSource());
}
}
if (c.getPushRefSpecs().isEmpty()) {
c.addPushRefSpec(
new RefSpec()
.setSourceDestination("refs/*", "refs/*")
.setForceUpdate(defaultForceUpdate));
}
DestinationConfiguration destinationConfiguration = new DestinationConfiguration(c, config);
if (!destinationConfiguration.isSingleProjectMatch()) {
for (URIish u : c.getURIs()) {
if (u.getPath() == null || !u.getPath().contains("${name}")) {
throw new ConfigInvalidException(
String.format(
"remote.%s.url \"%s\" lacks ${name} placeholder in %s",
c.getName(), u, config));
}
}
}
confs.add(destinationConfiguration);
}
return confs.build();
}