Only chmod if commit-msg hook was fetched successfully

There is no reason to attempt to chmod the commit-msg hook if it
failed to download, so use '&&' instead of ';'.

Some shells, and some shell extensions in particular (f.i. zsh and
oh-my-zsh), have url magic features that automatically attempt to
escape characters in conjunction with urls.

This can cause the current implementation to fail as it would escape
the ';' because it was connected to the curl command argument.
This in turn causes the curl command to fail as it would interpret
the chmod command as another argument to curl.

This resolves both issues by chaining the command instead.

Change-Id: I4304abbb11b7be63686bec51b200874fa00eab81
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/ b/src/main/java/com/googlesource/gerrit/plugins/download/command/
index 76d4166..431c8b9 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/
@@ -77,7 +77,7 @@
               .append(" ")
-              .append("; chmod +x ")
+              .append(" && chmod +x ")
diff --git a/src/test/java/com/googlesource/gerrit/plugins/download/command/ b/src/test/java/com/googlesource/gerrit/plugins/download/command/
index d4ca37c..24b521e 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/download/command/
+++ b/src/test/java/com/googlesource/gerrit/plugins/download/command/
@@ -117,7 +117,7 @@
   private String getDefaultHookCommand() {
     return String.format(
-        "(cd %s && mkdir -p %s && curl -Lo %scommit-msg https://%s/tools/hooks/commit-msg; chmod +x %scommit-msg)",
+        "(cd %s && mkdir -p %s && curl -Lo %scommit-msg https://%s/tools/hooks/commit-msg && chmod +x %scommit-msg)",
         baseName(ENV.projectName), HOOKS_DIR, HOOKS_DIR, ENV.fqdn, HOOKS_DIR);