diff options
author | Doug Kelly <doug.kelly@garmin.com> | 2013-11-21 17:10:19 -0600 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-11-22 00:43:40 +0000 |
commit | dd57e969b7bba785a90369f996b89f30d2e406f0 (patch) | |
tree | cd3a21d5e56fb4d5df6ce49132379ef5628a1236 /gerrit-server | |
parent | d0b6de2d6aa38c93e57a1cf066a748211863bd2c (diff) |
Use rev-parse to find gitdir when generating commit-msg hook hint
This updates the Change-Id validator hint to advise the user to use
"git rev-parse --git-dir" to find the proper gitdir, in case the
user is using submodules. Also, the gitdir is stored into a temp
variable, because msysgit has an unusual behavior related to the
path returned by rev-parse otherwise.
Change-Id: Ie4fcd0a73bd1cee12a052f38541f83aa8821c886
Diffstat (limited to 'gerrit-server')
-rw-r--r-- | gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java index a57f9239fa..d782cf02c4 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java @@ -507,9 +507,9 @@ public class CommitValidators { // If there are no SSH keys, the commit-msg hook must be installed via // HTTP(S) if (hostKeys.isEmpty()) { - String p = ".git/hooks/commit-msg"; + String p = "$gitdir/hooks/commit-msg"; return String.format( - " curl -o %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); } @@ -530,7 +530,7 @@ public class CommitValidators { sshPort = 22; } - return String.format(" scp -p -P %d %s@%s:hooks/commit-msg .git/hooks/", + return String.format(" gitdir=$(git rev-parse --git-dir) scp -p -P %d %s@%s:hooks/commit-msg $gitdir/hooks/", sshPort, currentUser.getUserName(), sshHost); } |