Commit 178cecb1 authored by Peter van der Does's avatar Peter van der Does Committed by Vincent Driessen

Implements do_hook function

Signed-off-by: 's avatarPeter van der Does <peter@avirtualhome.com>
Signed-off-by: 's avatarVincent Driessen <vincent@3rdcloud.com>
parent e4e0e0c9
...@@ -323,3 +323,24 @@ require_branches_equal() { ...@@ -323,3 +323,24 @@ require_branches_equal() {
fi fi
fi fi
} }
do_hook() {
local prefix="$1"
local return_code=0
if [ -z $prefix ]; then
die "Hook implementation error - No prefix given"
fi
if [ $prefix != "pre" ] && [ $prefix != "post" ]; then
die "Hook implementation error - Bad Prefix"
fi
if [ -x ${GITFLOW_CONF_DIR_HOOKS}${prefix}_${SUBCOMMAND}_${SUBACTION} ]; then
${GITFLOW_CONF_DIR_HOOKS}${prefix}_${SUBCOMMAND}_${SUBACTION}
return_code=$?
fi
if [ $return_code -gt 0 ]; then
die "Hook command ${prefix}_${SUBCOMMAND}_${SUBACTION} failed. Exit code $return_code"
fi
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment