Update Wireshark pre-commit tools (Add check for trailing whitespace based from git...
authorAlexis La Goutte <alexis.lagoutte@gmail.com>
Thu, 6 Mar 2014 17:00:43 +0000 (18:00 +0100)
committerAlexis La Goutte <alexis.lagoutte@gmail.com>
Thu, 6 Mar 2014 17:05:57 +0000 (17:05 +0000)
Change-Id: If8f5f48dfd96c3657036f7b59b6ca905c9d24043
Reviewed-on: https://code.wireshark.org/review/531
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
tools/pre-commit

index 2103d3482f9efe77023a669798ab6d7653170e32..46fe838655a706d627f971bbd9356823f8a5d84b 100755 (executable)
@@ -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