aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pre-commit
diff options
context:
space:
mode:
Diffstat (limited to 'tools/pre-commit')
-rwxr-xr-xtools/pre-commit8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/pre-commit b/tools/pre-commit
index 2103d3482f..46fe838655 100755
--- a/tools/pre-commit
+++ b/tools/pre-commit
@@ -7,7 +7,11 @@
# From
# http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
#
-for FILE in `git diff-index --cached --name-only HEAD | grep "\.[ch]$"` ; do
+
+# If there are whitespace errors, print the offending file names and fail. (from git pre-commit.sample)
+exec git diff-index --check --cached HEAD
+
+for FILE in `git diff-index --cached --name-only HEAD` ; do
#Exit immediately if a command exits with a non-zero status.
set -e
@@ -22,8 +26,6 @@ for FILE in `git diff-index --cached --name-only HEAD | grep "\.[ch]$"` ; do
#Check if fix-encoding-args is good
./tools/fix-encoding-args.pl $FILE
- #Add whitetrailing spaces...
- #perl -p -i -e 's/\ +$//' $(find . -name "*.[ch]" -print)
done
exit