ProjectRepairer: Pass remote rsync path via --protect-args

The remote path was Bourne-quoted on the assumption that a shell on
the destination would strip the quotes. When rsync runs in
protect-args mode, the quotes are kept and the receiver treats the
path as relative to the remote user's home, so the repair fails.

Drop the manual quoting and pass --protect-args so rsync sends the
path to the receiver without shell parsing on either side.

Change-Id: Icccecf67cabfefe894b29758ec17867b35d1c2e0
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ProjectRepairer.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ProjectRepairer.java
index d2e0edf..6535480 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ProjectRepairer.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ProjectRepairer.java
@@ -43,7 +43,6 @@
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.transport.URIish;
 import org.eclipse.jgit.util.FileUtils;
-import org.eclipse.jgit.util.QuotedString;
 import org.eclipse.jgit.util.io.StreamCopyThread;
 
 @Singleton
@@ -217,6 +216,7 @@
     cmd.add(replicationConfig.getRsyncPath());
     cmd.add("-av");
     cmd.add("--progress");
+    cmd.add("--protect-args");
     cmd.add("-e");
     cmd.add(buildSshTransport(uri));
     if (includes.length > 0) {
@@ -265,7 +265,7 @@
   private static String buildCopyDestination(URIish uri, String destDir) {
     String host = uri.getHost();
     String path = uri.getPath();
-    String remotePath = QuotedString.BOURNE.quote(path + "/" + destDir);
+    String remotePath = path + "/" + destDir;
     String user = uri.getUser();
     if (user != null && !user.isEmpty()) {
       return user + "@" + host + ":" + remotePath;