From c8feec1efcb1ddabc9bb757b26ff4aba80f82b81 Mon Sep 17 00:00:00 2001 From: Gustaf Lundh Date: Mon, 26 Mar 2012 16:01:40 +0200 Subject: [PATCH] Fix: Inconsistent behaviour when replicating refs/meta/config In replication.config, if authGroup is set to be used together with mirror = true, refs blocked through the authGroup are deleted from the slave/mirror. The same still (and rightly) applies if the authGroup is used to block refs/meta/config. However, if replicatePermission set to false, gerrit will refuse to clean up refs/meta/config on the slave/mirror. This fix makes sure that the Gerrit is still allowed to clean up all refs on the mirror, including refs/meta/config, even when used in conjunction with replicatePermission = false. Change-Id: Iea3f00e976d2d3e0bd8cb632530f65d79d9943ba --- .../java/com/google/gerrit/server/git/PushOp.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/PushOp.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/PushOp.java index 5c6cd25004..08687490ff 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/PushOp.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/PushOp.java @@ -343,10 +343,6 @@ class PushOp implements ProjectRunnable { if (config.isMirror()) { for (final Ref ref : remote.values()) { - if (noPerms && GitRepositoryManager.REF_CONFIG.equals(ref.getName())) { - continue; - } - if (!Constants.HEAD.equals(ref.getName())) { final RefSpec spec = matchDst(ref.getName()); if (spec != null && !local.containsKey(spec.getSource())) { @@ -360,16 +356,13 @@ class PushOp implements ProjectRunnable { } else { for (final String src : delta) { - if (noPerms && GitRepositoryManager.REF_CONFIG.equals(src)) { - continue; - } - final RefSpec spec = matchSrc(src); if (spec != null) { // If the ref still exists locally, send it, otherwise delete it. // Ref srcRef = local.get(src); - if (srcRef != null) { + if (srcRef != null && + !(noPerms && GitRepositoryManager.REF_CONFIG.equals(src))) { send(cmds, spec, srcRef); } else if (config.isMirror()) { delete(cmds, spec);