summaryrefslogtreecommitdiff
path: root/util/gitconfig
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2017-07-26 10:38:42 -0600
committerMartin Roth <martinroth@google.com>2017-07-29 21:36:38 +0000
commitef869305cfffc31b30c145c95c81e3284b88c5ac (patch)
treea6e3ce53d827016dc4083ecec181cc86f7516cd1 /util/gitconfig
parentc81800a0e1d3b579e453c2354b87fcdb374950c3 (diff)
downloadcoreboot-ef869305cfffc31b30c145c95c81e3284b88c5ac.tar.xz
util/gitconfig: update pre-commit script
The previous pre-commit script generates an error when a commit doesn't actually generate a patch file. This happens in rare instances when the only change in a patch is to update file permissions. Update the pre-commit script to verify that there's actually a patch before calling checkpatch. Also print that we're running checkpatch so that it doesn't look like odd failures come from lint-stable. Fixes Bug #132 - Problem with `lint-stable` when changing mode of file Change-Id: I142610b6fc984b2b14fd6c634bc4e7f2880ba987 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/20781 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'util/gitconfig')
-rwxr-xr-xutil/gitconfig/pre-commit8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/gitconfig/pre-commit b/util/gitconfig/pre-commit
index 70cd6eade1..257f6964bb 100755
--- a/util/gitconfig/pre-commit
+++ b/util/gitconfig/pre-commit
@@ -1,3 +1,9 @@
#!/bin/sh
%MAKE% lint-stable
-git diff --cached | util/lint/checkpatch.pl --no-signoff -q -
+
+PATCHDIFF=$(git diff --cached)
+if echo "$PATCHDIFF" | grep -q "@@"; then
+ echo
+ echo "Running checkpatch"
+ echo "$PATCHDIFF" | util/lint/checkpatch.pl --no-signoff -q -
+fi