Merge branch 'stable-3.10' into stable-3.11

* stable-3.10:
  Make excludedRefsPattern() to return an empty list by default
  Do not push deletes for refs configured to be skipped

Change-Id: Icab5579c4d3f1d8c8d2fac06492d063f6cab03d9
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 9c4ad4d..f9e1081 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
@@ -738,8 +738,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);
         }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/RemoteConfiguration.java b/src/main/java/com/googlesource/gerrit/plugins/replication/RemoteConfiguration.java
index 307017b..67d23b0 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/RemoteConfiguration.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/RemoteConfiguration.java
@@ -149,5 +149,7 @@
    *
    * @return list of successfully compiled patterns
    */
-  ImmutableList<Pattern> excludedRefsPattern();
+  default ImmutableList<Pattern> excludedRefsPattern() {
+    return ImmutableList.of();
+  }
 }
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index 6cd0db1..67c201c 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -610,6 +610,8 @@
   example refs created by plugins. Multiple excludedRefsPattern keys can be
   supplied, to specify multiple patterns to match against.
 
+  Do not exclude any refs pattern by default.
+
 Directory `replication`
 --------------------
 The optional directory `$site_path/etc/replication` contains Git-style