qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] checkpatch: add a little script to run checkpatch a


From: Anthony Liguori
Subject: [Qemu-devel] [PATCH] checkpatch: add a little script to run checkpatch against a git refspec
Date: Mon, 21 Jan 2013 10:48:56 -0600

This makes it easier to use checkpatch with a git hook or via patches.

Signed-off-by: Anthony Liguori <address@hidden>
---
 scripts/check-patches.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100755 scripts/check-patches.sh

diff --git a/scripts/check-patches.sh b/scripts/check-patches.sh
new file mode 100755
index 0000000..5a693fe
--- /dev/null
+++ b/scripts/check-patches.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# checkpatch helper - run checkpatch against each commit given a refspec
+#
+# Copyright IBM, Corp. 2013
+#
+# Authors:
+#  Anthony Liguori <address@hidden>
+#
+# This work is licensed under the terms of the GNU GPLv2 or later.
+# See the COPYING file in the top-level directory.
+
+if test -z "$1"; then
+    echo "Usage: $0 REFSPEC"
+    exit 1
+fi
+
+git log --format="%H" "$@" | while read commit; do
+    git show --format=email $commit | scripts/checkpatch.pl -
+    rc=$?
+    if test $rc -ne 0; then
+       exit $rc
+    fi
+done
-- 
1.8.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]