]> gitweb.fluxo.info Git - git-hooks.git/commitdiff
When listing hooks use GITDIR and pipe stderr to dev/null
authorBenjamin C Meyer <ben@meyerhome.net>
Sat, 19 Jun 2010 20:10:43 +0000 (16:10 -0400)
committerBenjamin C Meyer <ben@meyerhome.net>
Sat, 19 Jun 2010 20:10:43 +0000 (16:10 -0400)
Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
git-hooks

index 44f706d8c2b7a05cd9c0170d3c837ab2e1e1219f..171a91614f3634bc83c1c660600a2b7eb7b2e70a 100755 (executable)
--- a/git-hooks
+++ b/git-hooks
@@ -111,10 +111,9 @@ git-hooks run "$0" "$@"' > "${file}"
 
 function list_hooks
 {
-    while [ ! -d ".git" ] ; do
-        cd ..
-    done
-    cat .git/hooks/pre-commit | grep 'git-hooks' > /dev/null 2> /dev/null
+    GITDIR=`git rev-parse --git-dir`
+    cd $GITDIR
+    cat hooks/pre-commit 2> /dev/null | grep 'git-hooks' > /dev/null 2> /dev/null
     if [ $? = 0 ] ; then
         echo "Git hooks ARE installed in this repository."
         echo ""