Skip to content

Instantly share code, notes, and snippets.

@tlync
Created October 17, 2014 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlync/22da4866ca9a34241eac to your computer and use it in GitHub Desktop.
Save tlync/22da4866ca9a34241eac to your computer and use it in GitHub Desktop.
#!/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