diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2013-09-09 19:30:39 +0000 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2013-09-09 19:30:39 +0000 |
commit | 45b9f5964b7f4f26749c67f8bd1513001decd6fa (patch) | |
tree | 702361da1f1409b32c07d341253d4f55c48be601 /tools/pre-commit | |
parent | 80f9326b2fbf8857f221b6ee6d44c3982cdcbff9 (diff) |
Add my pre-commit git script (with checkAPI/hf/encoding args...) Need to copy in .git/hooks folder and will be launch all check when make local commit (if there is some false-positive add --no-verify to disable check)
Should be enhance to be better (check trailing/whitespace...)
svn path=/trunk/; revision=51884
Diffstat (limited to 'tools/pre-commit')
-rwxr-xr-x | tools/pre-commit | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/pre-commit b/tools/pre-commit new file mode 100755 index 0000000000..166b76cb93 --- /dev/null +++ b/tools/pre-commit @@ -0,0 +1,44 @@ +#!/bin/sh +# Copyright 2013, Alexis La Goutte (See AUTHORS file) +# +# $Id$ +# +# 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` ; 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: +# |