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
This commit is contained in:
@@ -343,10 +343,6 @@ class PushOp implements ProjectRunnable {
|
|||||||
|
|
||||||
if (config.isMirror()) {
|
if (config.isMirror()) {
|
||||||
for (final Ref ref : remote.values()) {
|
for (final Ref ref : remote.values()) {
|
||||||
if (noPerms && GitRepositoryManager.REF_CONFIG.equals(ref.getName())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Constants.HEAD.equals(ref.getName())) {
|
if (!Constants.HEAD.equals(ref.getName())) {
|
||||||
final RefSpec spec = matchDst(ref.getName());
|
final RefSpec spec = matchDst(ref.getName());
|
||||||
if (spec != null && !local.containsKey(spec.getSource())) {
|
if (spec != null && !local.containsKey(spec.getSource())) {
|
||||||
@@ -360,16 +356,13 @@ class PushOp implements ProjectRunnable {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (final String src : delta) {
|
for (final String src : delta) {
|
||||||
if (noPerms && GitRepositoryManager.REF_CONFIG.equals(src)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final RefSpec spec = matchSrc(src);
|
final RefSpec spec = matchSrc(src);
|
||||||
if (spec != null) {
|
if (spec != null) {
|
||||||
// If the ref still exists locally, send it, otherwise delete it.
|
// If the ref still exists locally, send it, otherwise delete it.
|
||||||
//
|
//
|
||||||
Ref srcRef = local.get(src);
|
Ref srcRef = local.get(src);
|
||||||
if (srcRef != null) {
|
if (srcRef != null &&
|
||||||
|
!(noPerms && GitRepositoryManager.REF_CONFIG.equals(src))) {
|
||||||
send(cmds, spec, srcRef);
|
send(cmds, spec, srcRef);
|
||||||
} else if (config.isMirror()) {
|
} else if (config.isMirror()) {
|
||||||
delete(cmds, spec);
|
delete(cmds, spec);
|
||||||
|
Reference in New Issue
Block a user