Files
dotfiles/git/templates/hooks/run-hooks.sh
Nick Nisi 32e2d1f363 Add default git hooks
This is a set of global, reusable git hooks that can be added to any git
project
2013-07-27 10:58:35 -05:00

24 lines
428 B
Bash
Executable File

#!/bin/sh
EXIT_CODE=0
repo=$( git rev-parse --show-toplevel )
hook_type=$( basename $0 )
hooks=~/.dotfiles/git/hooks
echo "Executing $hook_type hook(s)"
for hook in $hooks/*.$hook_type; do
echo ""
echo "${COLOR_LIGHTPURPLE}Executing ${hook}${COLOR_NONE}"
${hook}
EXIT_CODE=$((${EXIT_CODE} + $?))
done
if [[ ${EXIT_CODE} -ne 0 ]]; then
echo ""
echo "${COLOR_RED}Commit Failed.${COLOR_NONE}"
fi
exit $((${EXIT_CODE}))