Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use rev-parse --git-dir to determine the location of the GITDIR.

Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
  • Loading branch information...
commit c07c99d6178d02e910c52760f8d022e24ac2c9ca 1 parent a35f95a
Benjamin C Meyer authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 git-hooks
7 git-hooks
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.