Created
July 23, 2015 09:36
-
-
Save gsomoza/5f05296b55b86828a1d2 to your computer and use it in GitHub Desktop.
Git pre-push hook for Ant
This file contains hidden or 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/bash | |
# FILE: .git/hooks/pre-push | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
read -p "You're about to push $current_branch. Did you already build with Ant? [y|n] " -n 1 -r < /dev/tty | |
echo | |
if echo $REPLY | grep -E '^[Yy]$' > /dev/null | |
then | |
exit 0 # push will execute | |
fi | |
echo "Building, please wait..." | |
ANT_RESULT=`ant` | |
ANT_EXIT=$? | |
echo "$ANT_RESULT" | |
exit $ANT_EXIT # push will execute if Ant succeded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment