Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
Make .git/hooks directory
Change-Id: I6eb852fe39819d324b768b8c13c026760871263e
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneWithCommitMsgHook.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneWithCommitMsgHook.java
index dbb793c..971840b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneWithCommitMsgHook.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneWithCommitMsgHook.java
@@ -29,6 +29,7 @@
private static final String TARGET = " `git rev-parse --git-dir`/";
private final String configCommand;
+ private final String extraCommand;
private final SshScheme sshScheme;
private final Provider<CurrentUser> userProvider;
@@ -36,6 +37,7 @@
CloneWithCommitMsgHook(
@GerritServerConfig Config config, SshScheme sshScheme, Provider<CurrentUser> userProvider) {
this.configCommand = config.getString("gerrit", null, "installCommitMsgHookCommand");
+ this.extraCommand = config.getString("gerrit", null, "installCommitExtraCommand");
this.sshScheme = sshScheme;
this.userProvider = userProvider;
}
@@ -77,6 +79,9 @@
.append(projectName)
.append("/.git/hooks/");
+ if (extraCommand != null) {
+ b.append(" && (cd ").append(projectName).append(" && ").append(extraCommand).append(")");
+ }
return b.toString();
}
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index 3e76bdb..3781f9e 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -74,7 +74,7 @@
advertisement (`uploadpack.hideRefs`). This option can be used to
hide the change refs from the client. As consequence fetching
changes by change ref does not work anymore. However by setting
- `uploadpack.allowTipSha1InWant` to `true` fetching changes by
+ `uploadpack.allowTipSHA1InWant` to `true` fetching changes by
commit ID is possible. If `download.checkForHiddenChangeRefs` is
set to `true` the git download commands use the commit ID instead
of the change ref when a project is configured like this.
@@ -84,6 +84,28 @@
[uploadpack]
hideRefs = refs/changes/
hideRefs = refs/cache-automerge/
- allowTipSha1InWant = true
+ allowTipSHA1InWant = true
By default `false`.
+
+
+### <a id="gerrit">Section gerrit</a>
+
+```
+[gerrit]
+ installCommitMsgHookCommand = command
+ installCommitExtraCommand = command
+```
+
+<a id="gerrit.installCommitMsgHookCommand">gerrit.installCommitMsgHookCommand</a>
+ Optional command to install the commit-msg hook. Typically of the form:
+ `fetch-cmd some://url/to/commit-msg .git/hooks/commit-msg ; chmod +x .git/hooks/commit-msg`
+ By default unset; falls back to using scp from the canonical SSH host,
+ or curl from the canonical HTTP URL for the server. Only necessary
+ if a proxy or other server/network configuration prevents clients
+ from fetching from the default location.
+
+<a id="gerrit.installCommitExtraCommand">gerrit.installCommitExtraCommand</a>
+ Optional command to complete the commit-msg hook. For example:
+ `git submodule update --init --recursive && git review -s`
+ would initialize the submodules and setup git review.
\ No newline at end of file