summaryrefslogtreecommitdiff
path: root/tools/pre-commit
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2015-12-31 15:14:06 +0000
committerMichael Mann <mmann78@netscape.net>2016-01-05 21:32:22 +0000
commit5815d1080ad7b934f120a54e7c8f85c3617f539c (patch)
tree0b827ef60904cde64d36721cbbf519f955d13fcf /tools/pre-commit
parent0fa5a78a867cb683c6b83c2514c77b152f1b4e1f (diff)
downloadwireshark-5815d1080ad7b934f120a54e7c8f85c3617f539c.tar.gz
Add basic exclude facility to pre-commit hook checks
Change-Id: If08fd1481e58f785fed90a7d8c24aa2a1e0f3df7 Reviewed-on: https://code.wireshark.org/review/12958 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tools/pre-commit')
-rwxr-xr-xtools/pre-commit8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/pre-commit b/tools/pre-commit
index e83971902e..bfc8aedeaa 100755
--- a/tools/pre-commit
+++ b/tools/pre-commit
@@ -27,6 +27,9 @@ hook_script=${GIT_DIR:-.git}/hooks/pre-commit
# invocations via relative paths (such as ../tools/pre-commit):
cd "$(git rev-parse --show-toplevel)"
+# Path to excluded files listing
+excludes=./tools/pre-commit-checkignore.txt
+
# Check for newer (actually, different) versions of the pre-commit script
# (but only if invoked as hook, i.e. the commit ID is not given as argument).
if [ -z "$1" ] && ! cmp -s "$hook_script" tools/pre-commit; then
@@ -37,6 +40,11 @@ exit_status=0
for FILE in `git diff-index --cached --name-status ${COMMIT_ID} | grep -v "^D" | cut -f2 | grep "\.[ch]$" | grep -v "extcap/"` ; do
+ #Skip if listed
+ if [ -e $excludes ] && grep -Fxq "$FILE" "$excludes"; then
+ continue
+ fi
+
#Check if checkhf is good
./tools/checkhf.pl $FILE || exit_status=1