From: Benjamin C Meyer Date: Sat, 19 Jun 2010 17:32:35 +0000 (-0400) Subject: Use rev-parse --git-dir to determine the location of the GITDIR. X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=c07c99d6178d02e910c52760f8d022e24ac2c9ca;p=git-hooks.git Use rev-parse --git-dir to determine the location of the GITDIR. Signed-off-by: Benjamin C Meyer --- diff --git a/git-hooks b/git-hooks index 4ac5bc0..649d08a 100755 --- a/git-hooks +++ b/git-hooks @@ -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