aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin C Meyer <ben@meyerhome.net>2010-06-19 12:33:21 -0400
committerBenjamin C Meyer <ben@meyerhome.net>2010-06-19 12:33:21 -0400
commit4c1dd86f9edd291bfcdfc3c636f53d25dddc3928 (patch)
tree5913e9adf6c2b3ab23e5206efe5af111c4ff0c51
parentb25ce6eb47bbe234cb162ebb3e8789d202c9e127 (diff)
downloadgit-hooks-4c1dd86f9edd291bfcdfc3c636f53d25dddc3928.tar.gz
git-hooks-4c1dd86f9edd291bfcdfc3c636f53d25dddc3928.tar.bz2
Only set the hook variable when an argument is passed to hook_dirs, otherwise hook will be '/' and if there is no git config option will result in / being returned as a valid git hook which it is not
Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
-rwxr-xr-xgit-hooks12
1 files changed, 8 insertions, 4 deletions
diff --git a/git-hooks b/git-hooks
index 9c40e14..4ac5bc0 100755
--- a/git-hooks
+++ b/git-hooks
@@ -28,10 +28,14 @@
function hook_dirs
{
- hook="${1}"
- echo "${HOME}/.git_hooks/${hook}"
- echo "${PWD}/git_hooks/${hook}"
- echo "`git config hooks.global`"/${hook}
+ if [ ! -z "${1}" ] ; then
+ hook="/${1}"
+ else
+ hook=""
+ fi
+ echo "${HOME}/.git_hooks${hook}"
+ echo "${PWD}/git_hooks${hook}"
+ echo "`git config hooks.global`"${hook}
}
function list_hooks_in_dir