Do not push deletes for refs configured to be skipped When pushing a delta set of refs, instead of treating non-existent and !canPush() refs the same, use the same logic as when pushing all refs and log and skip any !canPush() refs. Release-Notes: refs configured to be skipped are not pushed as deletes Change-Id: I3491c907580b16ea23493a5eaa325d2ef7d6d108
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java index b516fc7..c49890a 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
@@ -742,8 +742,12 @@ srcRef = git.exactRef(src); } - if (srcRef != null && canPushRef(src, noPerms)) { - push(cmds, spec, srcRef); + if (srcRef != null) { + if (canPushRef(srcRef.getName(), noPerms)) { + push(cmds, spec, srcRef); + } else { + repLog.atFine().log("Skipping push of ref %s", srcRef.getName()); + } } else if (config.isMirror()) { delete(cmds, spec); }