Created
May 4, 2015 13:36
-
-
Save HaykoKoryun/e987e847e2f69e311162 to your computer and use it in GitHub Desktop.
snitch
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/bash | |
# change the following two params, | |
# set up a cron job and there you go! | |
email="bob@mail.com" | |
site="your site" | |
cd "$(dirname "$0")" | |
if [ ! -f snitch.log ]; then | |
touch snitch.log | |
fi | |
# if git diff finds a difference between | |
# HEAD and what we have now, snitch! | |
if [[ -n $(git diff --name-only HEAD) ]]; then | |
git diff --name-only HEAD > snitchtemp.log | |
if [[ -n $(diff snitch.log snitchtemp.log) ]]; then | |
git diff --name-only HEAD > snitch.log | |
cat snitch.log | mail -s "snitch@$site" "$email" | |
fi | |
else | |
echo "OK" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment