diff options
author | Benjamin C Meyer <ben@meyerhome.net> | 2010-06-19 13:32:35 -0400 |
---|---|---|
committer | Benjamin C Meyer <ben@meyerhome.net> | 2010-06-19 13:32:44 -0400 |
commit | c07c99d6178d02e910c52760f8d022e24ac2c9ca (patch) | |
tree | db841fb231b7eb0fbf7548da59edd212f638fc4a | |
parent | a35f95adb25d73eda16cd7930366ab3c9fa1ff61 (diff) | |
download | git-hooks-c07c99d6178d02e910c52760f8d022e24ac2c9ca.tar.gz git-hooks-c07c99d6178d02e910c52760f8d022e24ac2c9ca.tar.bz2 |
Use rev-parse --git-dir to determine the location of the GITDIR.
Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
-rwxr-xr-x | git-hooks | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -82,11 +82,12 @@ function run_hook function install_hooks { - if [ ! -d ".git" ] ; then - echo "$1 must be run in the same directory as .git/" + GITDIR=`git rev-parse --git-dir` + if [ ! $? -eq 0 ] ; then + echo "$1 must be run inside a git repository" return 1 fi - cd .git/ + cd $GITDIR if [ "${1}" = "--install" ] ; then mv hooks hooks.old mkdir hooks |