wireshark/tools/pre-commit
Alexis La Goutte 2e1f11289b Enhance pre-commit tools to avoid false positive
Limit check to file with extension *.c or *.h

Change-Id: I6e237e6fd053083d271924120973a6b07e2d4e53
Reviewed-on: https://code.wireshark.org/review/247
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-20 18:24:05 +00:00

43 lines
1 KiB
Bash
Executable file

#!/bin/sh
# Copyright 2013, Alexis La Goutte (See AUTHORS file)
#
# For git user, copy pre-commit in .git/hook/ folder
# to don't launch the script when commit use --no-verify argument
#
# 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
#Exit immediately if a command exits with a non-zero status.
set -e
#Check if checkhf is good
./tools/checkhf.pl $FILE
#Check if checkAPIs is good
./tools/checkAPIs.pl $FILE
#Check if fix-encoding-args is good
./tools/fix-encoding-args.pl $FILE
#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
#
# Editor modelines
#
# Local Variables:
# c-basic-offset: 4
# tab-width: 8
# indent-tabs-mode: nil
# End:
#
# ex: set shiftwidth=4 tabstop=8 expandtab:
# :indentSize=4:tabSize=8:noTabs=true:
#