Created
May 3, 2012 13:42
-
-
Save rpq/2585732 to your computer and use it in GitHub Desktop.
git pre-commit hook: windows character (^M - ctrl-v ctrl-m) check
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
59 CTRL_M=`git status | grep modified | awk -F" " '{print $3}' | xargs -I '{}' grep -nPH "^M$" {}` | |
60 CTRL_M_COUNT=`echo "$CTRL_M" | wc -w` | |
61 if [ "$CTRL_M_COUNT" != "0" ]; then | |
62 echo "$CTRL_M" | xargs -I '{}' echo ">> git pre-commit hook: CTRL-M in {}" | |
63 exit 1 | |
64 fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment