19 lines
391 B
Bash
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
|