dotfiles/private_dot_config/git-hooks/executable_pre-commit
2023-01-18 13:42:14 +01:00

19 lines
391 B
Bash

#!/bin/bash
#
# Based on https://stackoverflow.com/questions/26624368/handle-multiple-pre-commit-hooks
#
# Calls each script in 'pre-commit.d'
hook_dir=$(dirname "$0")
for hook in "$hook_dir"/pre-commit.d/*; do
bash "$hook"
RESULT=$?
if [ $RESULT != 0 ]; then
echo "pre-commit.d${hook} returned non-zero: $RESULT, abort commit"
exit $RESULT
fi
done
exit 0