or when the repository is a bare repository
Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
hook=""
fi
echo "${HOME}/.git_hooks${hook}"
- GITDIR=`git rev-parse --git-dir`
- cd $GITDIR/..
- echo "${PWD}/git_hooks${hook}"
- echo "${PWD}/.githooks${hook}"
+ git rev-parse --git-dir &> /dev/null
+ if [ $? -eq 0 ]; then
+ if [ $(git rev-parse --is-bare-repository) = 'false' ]; then
+ cd $(git rev-parse --show-toplevel)
+ echo "${PWD}/git_hooks${hook}"
+ echo "${PWD}/.githooks${hook}"
+ fi
+ fi
eval echo "`git config hooks.global`"${hook}
}