Skip to content
Browse files

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>
  • Loading branch information...
1 parent 5a8fdca commit 391a00aed0fc73e306be831499818c5b60da3360 @icefox committed Mar 20, 2010
Showing with 8 additions and 0 deletions.
  1. +8 −0 git-hooks
View
8 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

0 comments on commit 391a00a

Please sign in to comment.
Something went wrong with that request. Please try again.