Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add handing of exit codes to post hooks #20

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions gitflow-common
Original file line number Diff line number Diff line change
Expand Up @@ -794,14 +794,21 @@ run_pre_hook() {
# post-flow-<subcmd>-<subaction>
#
# If such a hook script exists and is executable, it is called with the given
# positional arguments. Its return code is ignored.
# positional arguments. If its return code non-zero, the git-flow action is
# aborted.
#
run_post_hook() {
local scriptfile
local scriptfile exitcode

scriptfile="${HOOKS_DIR}/post-flow-${SUBCOMMAND}-${SUBACTION}"
exitcode=0
if [ -x "$scriptfile" ]; then
"$scriptfile" "$@"
exitcode=$?

if [ $exitcode -gt 0 ]; then
die "Hook command $scriptfile ended with exit code $exitcode."
fi
fi
}

Expand Down