From patchwork Mon Jan 21 16:48:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: checkpatch: add a little script to run checkpatch against a git refspec Date: Mon, 21 Jan 2013 06:48:56 -0000 From: Anthony Liguori X-Patchwork-Id: 214226 Message-Id: <1358786936-14818-1-git-send-email-aliguori@us.ibm.com> To: qemu-devel@nongnu.org Cc: Blue Swirl , Anthony Liguori This makes it easier to use checkpatch with a git hook or via patches. Signed-off-by: Anthony Liguori --- 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 +# +# 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