aboutsummaryrefslogtreecommitdiffstats
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
parent0fa5a78a867cb683c6b83c2514c77b152f1b4e1f (diff)
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>
-rwxr-xr-xtools/pre-commit8
-rw-r--r--tools/pre-commit-checkignore.txt11
2 files changed, 19 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
diff --git a/tools/pre-commit-checkignore.txt b/tools/pre-commit-checkignore.txt
new file mode 100644
index 0000000000..d7598f4c9d
--- /dev/null
+++ b/tools/pre-commit-checkignore.txt
@@ -0,0 +1,11 @@
+# Files listed here are ignored by the git pre-commit hook for the
+# purpose of checking for forbidden APIs and other dissector-specific
+# glitches.
+#
+# Each line must match a single file using the full path, exactly as
+# return by 'git diff-index --name-only', e.g.:
+#
+#tools/pre-commit-checkignore.txt
+#
+
+tools/lemon/lemon.c