]> gitweb.fluxo.info Git - git-hooks.git/commitdiff
Use rev-parse --git-dir to determine the location of the GITDIR.
authorBenjamin C Meyer <ben@meyerhome.net>
Sat, 19 Jun 2010 17:32:35 +0000 (13:32 -0400)
committerBenjamin C Meyer <ben@meyerhome.net>
Sat, 19 Jun 2010 17:32:44 +0000 (13:32 -0400)
Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
git-hooks

index 4ac5bc0d52aa61ec4d38ffa56c013716d156c4e8..649d08ad4b6670059a1f3903f028ec98090a91c5 100755 (executable)
--- 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