[coreboot-gerrit] Change in coreboot[master]: util/gitconfig: update pre-commit script

Martin Roth (Code Review) gerrit at coreboot.org
Wed Jul 26 18:39:23 CEST 2017


Martin Roth has uploaded this change for review. ( https://review.coreboot.org/20781


Change subject: util/gitconfig: update pre-commit script
......................................................................

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 at google.com>
---
M util/gitconfig/pre-commit
1 file changed, 7 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/20781/1

diff --git a/util/gitconfig/pre-commit b/util/gitconfig/pre-commit
index 70cd6ea..257f696 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

-- 
To view, visit https://review.coreboot.org/20781
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I142610b6fc984b2b14fd6c634bc4e7f2880ba987
Gerrit-Change-Number: 20781
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170726/e7931ae6/attachment.html>


More information about the coreboot-gerrit mailing list