Created
January 30, 2014 18:04
-
-
Save nickwynja/8714812 to your computer and use it in GitHub Desktop.
Hazel: Check for git changes
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
# Update the index | |
git update-index -q --ignore-submodules --refresh | |
err=0 | |
# Disallow unstaged changes in the working tree | |
if ! git diff-files --quiet --ignore-submodules -- | |
then | |
err=1 | |
fi | |
# Disallow uncommitted changes in the index | |
if ! git diff-index --cached --quiet HEAD --ignore-submodules -- | |
then | |
err=1 | |
fi | |
if [ $err = 1 ] | |
then | |
exit 0 | |
elif [ $err = 0] | |
then | |
exit 1; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment