aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin C Meyer <ben@meyerhome.net>2010-03-20 16:59:40 -0400
committerBenjamin C Meyer <ben@meyerhome.net>2010-03-20 16:59:40 -0400
commit391a00aed0fc73e306be831499818c5b60da3360 (patch)
treeeb9fdd6fb7f0c6deae73a67b4f93c259761d5ca1
parent5a8fdca6f5d4daf8c9bfd62410df0c69e7826552 (diff)
downloadgit-hooks-391a00aed0fc73e306be831499818c5b60da3360.tar.gz
git-hooks-391a00aed0fc73e306be831499818c5b60da3360.tar.bz2
Verify that all required arguments are passed in and return with an
error if they are not. Signed-off-by: Benjamin C Meyer <ben@meyerhome.net>
-rwxr-xr-xgit-hooks8
1 files changed, 8 insertions, 0 deletions
diff --git a/git-hooks b/git-hooks
index 9e4e7e2..89b0489 100755
--- a/git-hooks
+++ b/git-hooks
@@ -47,6 +47,10 @@ function list_hooks_in_dir
function run_hooks
{
dir="${1}"
+ if [[ -z ${dir} || ! -d "${dir}" ]] ; then
+ echo "run_hooks requires a directory name as an argument."
+ return 1
+ fi
shift 1
for hook in `list_hooks_in_dir "${dir}"`
do
@@ -63,6 +67,10 @@ function run_hook
{
set -e
hook=`basename "${1}"`
+ if [ -z ${hook} ] ; then
+ echo "run requires a hook argument"
+ return 1
+ fi
shift 1
for dir in `hook_dirs "${hook}"`; do
if [ ! -d "${dir}" ] ; then