Merge branch 'stable-2.11'

* stable-2.11:
  Revert "Replicate HEAD reference when replicating a project"

Change-Id: I1beaa53c388c5f0d832dec5bb25b1c880cca6237
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 331f8fd..4a2d01b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
@@ -373,7 +373,6 @@
     PushResult res;
     try {
       res = pushVia(tn);
-      updateHead();
     } finally {
       try {
         tn.close();
@@ -541,11 +540,6 @@
     cmds.add(new RemoteRefUpdate(git, (Ref) null, dst, force, null, null));
   }
 
-  private void updateHead() throws IOException {
-    replicationQueue.updateHead(projectName, git.getRef(Constants.HEAD)
-        .getTarget().getName());
-  }
-
   private void updateStates(Collection<RemoteRefUpdate> refUpdates)
       throws LockFailureException {
     Set<String> doneRefs = new HashSet<>();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
index 58721bf..67d172f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
@@ -167,13 +167,9 @@
 
   @Override
   public void onHeadUpdated(HeadUpdatedListener.Event event) {
-    updateHead(new Project.NameKey(event.getProjectName()),
-        event.getNewHeadName());
-  }
-
-  void updateHead(Project.NameKey project, String newHeadName) {
-    for (URIish uri : getURIs(project, FilterType.ALL)) {
-      updateHead(uri, newHeadName);
+    for (URIish uri : getURIs(new Project.NameKey(event.getProjectName()),
+        FilterType.ALL)) {
+      updateHead(uri, event.getNewHeadName());
     }
   }