Created
October 17, 2014 10:58
-
-
Save tlync/22da4866ca9a34241eac to your computer and use it in GitHub Desktop.
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 | |
commits=`git log @{u}..` | |
if [ -z "$commits" ]; then | |
exit 0 | |
fi | |
COLOR_MAIN="\x1B[01;91m" | |
COLOR_SUB="\x1B[01;90m" | |
COLOR_PASS="\x1B[32m" | |
COLOR_FAIL="\x1B[31m" | |
COLOR_END="\x1B[0m" | |
prepush() { | |
MSG=[${COLOR_MAIN}git${COLOR_SUB}:${COLOR_END}${COLOR_MAIN}pre-push${COLOR_END}] | |
echo $MSG $1 | |
$1 | |
if [ $? -eq 0 ]; then | |
echo $MSG $1 … ${COLOR_PASS}PASS${COLOR_END} | |
else | |
echo $MSG $1 … ${COLOR_FAIL}FAIL${COLOR_END} | |
exit 1 | |
fi | |
} | |
# write pre-push commands here | |
prepush "sbt scalastyle" | |
prepush "sbt test" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment