Created
April 12, 2012 14:00
-
-
Save AlexChittock/2367494 to your computer and use it in GitHub Desktop.
Expands a git hook event to execute multiple scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Executes multiple scripts on a git event | |
# | |
# Expects scripts to be arranged like: | |
# some/directory/for/hooks/ | |
# pre-commit/ | |
# safe-debug.sh | |
# validate.sh | |
# update/ | |
# email.sh | |
# | |
# So for the update hook, we'd set HOOK_DIR as | |
# | |
# HOOK_DIR="some/directory/for/hooks/" | |
# | |
# and save the file as ".git/hooks/update" | |
# | |
# Edit this line | |
HOOK_DIR="tools/hooks/" | |
# Don't edit these | |
hook=`basename $0` | |
dir=$HOOK_DIR$hook | |
if [ -d $dir ]; then | |
echo "Executing "$hook" hooks"; | |
find $dir -name '*.sh' -exec {} \; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment