in src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java [707:729]
private List<RemoteRefUpdate> doPushDelta(Map<String, Ref> local) throws IOException {
List<RemoteRefUpdate> cmds = new ArrayList<>();
boolean noPerms = !pool.isReplicatePermissions();
for (String src : delta) {
RefSpec spec = matchSrc(src);
if (spec != null) {
// If the ref still exists locally, send it, otherwise delete it.
Ref srcRef = local.get(src);
// Second try to ensure that the ref is truly not found locally
if (srcRef == null) {
srcRef = git.exactRef(src);
}
if (srcRef != null && canPushRef(src, noPerms)) {
push(cmds, spec, srcRef);
} else if (config.isMirror()) {
delete(cmds, spec);
}
}
}
return cmds;
}