2 # Copyright 2013, Alexis La Goutte (See AUTHORS file)
4 # For git user, copy pre-commit in .git/hook/ folder
5 # to don't launch the script when commit use --no-verify argument
8 # http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
11 # Check for newer versions of the pre-commit script
12 if [ ./.git/hooks/pre-commit -ot ./tools/pre-commit ] ; then
13 echo "Pre-commit hook script is outdated, please update!"
16 for FILE in `git diff-index --cached --name-only HEAD | grep "\.[ch]$"` ; do
17 #Exit immediately if a command exits with a non-zero status.
20 #Check if checkhf is good
21 ./tools/checkhf.pl $FILE
23 #Check if checkAPIs is good
24 ./tools/checkAPIs.pl $FILE
26 #Check if fix-encoding-args is good
27 ./tools/fix-encoding-args.pl $FILE
29 #Check if fix-encoding-args is good
30 ./tools/fix-encoding-args.pl $FILE
34 # If there are whitespace errors, print the offending file names and fail. (from git pre-commit.sample)
35 exec git diff-index --check --cached HEAD
45 # indent-tabs-mode: nil
48 # ex: set shiftwidth=4 tabstop=8 expandtab:
49 # :indentSize=4:tabSize=8:noTabs=true: