Last active
November 17, 2022 08:07
-
-
Save shrop/5995086 to your computer and use it in GitHub Desktop.
Improved script for highlighting git repo folders which have unstated/uncommitted files. An improvement on the script for the Hazel rule created by @tylerhall: http://clickontyler.com/blog/2013/03/hazel-and-git. This improvement checks to see if the folder is actually a git repo and if not, doesn't bother processing any further.
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
dirname=$1 | |
if [ -f $dirname ]; then | |
dirname=`dirname $dirname` | |
fi | |
cd $dirname | |
if [ ! -d .git ]; then | |
exit 1 | |
fi | |
if git status | grep --quiet "working directory clean"; then | |
exit 1 | |
else | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment