Merge branch 'stable-2.7' into stable-2.8
* stable-2.7: Fix commit-msg hint to actually work Conflicts: gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java Change-Id: I4b8d6c0d265d015f45fd31cb1fd284e32b7985eb
This commit is contained in:
@@ -59,9 +59,6 @@ public class CommitValidators {
|
|||||||
|
|
||||||
private static final FooterKey CHANGE_ID = new FooterKey("Change-Id");
|
private static final FooterKey CHANGE_ID = new FooterKey("Change-Id");
|
||||||
|
|
||||||
private static final String GIT_HOOKS_COMMIT_MSG =
|
|
||||||
"`git rev-parse --git-dir`/hooks/commit-msg";
|
|
||||||
|
|
||||||
public interface Factory {
|
public interface Factory {
|
||||||
CommitValidators create(RefControl refControl, SshInfo sshInfo,
|
CommitValidators create(RefControl refControl, SshInfo sshInfo,
|
||||||
Repository repo);
|
Repository repo);
|
||||||
@@ -268,11 +265,11 @@ public class CommitValidators {
|
|||||||
|
|
||||||
// If there are no SSH keys, the commit-msg hook must be installed via
|
// If there are no SSH keys, the commit-msg hook must be installed via
|
||||||
// HTTP(S)
|
// HTTP(S)
|
||||||
String p = GIT_HOOKS_COMMIT_MSG;
|
|
||||||
if (hostKeys.isEmpty()) {
|
if (hostKeys.isEmpty()) {
|
||||||
|
String p = "${gitdir}/hooks/commit-msg";
|
||||||
return String.format(
|
return String.format(
|
||||||
" curl -Lo %s %s/tools/hooks/commit-msg ; chmod +x %s", p,
|
" gitdir=$(git rev-parse --git-dir); curl -o %s %s/tools/hooks/commit-msg ; chmod +x %s", p,
|
||||||
getGerritUrl(canonicalWebUrl), p);
|
getGerritUrl(canonicalWebUrl), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SSH keys exist, so the hook can be installed with scp.
|
// SSH keys exist, so the hook can be installed with scp.
|
||||||
@@ -292,8 +289,8 @@ public class CommitValidators {
|
|||||||
sshPort = 22;
|
sshPort = 22;
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.format(" scp -p -P %d %s@%s:hooks/commit-msg %s",
|
return String.format(" gitdir=$(git rev-parse --git-dir); scp -p -P %d %s@%s:hooks/commit-msg ${gitdir}/hooks/",
|
||||||
sshPort, user.getUserName(), sshHost, p);
|
sshPort, user.getUserName(), sshHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user