なんてものが、LKMLに投稿されているな


Date: Wed, 20 Jan 2010 02:02:02 +0000
From: Ben Dooks
To: linux-arm-kernel@lists.infradead.org,
Linux Samsung SoC ,
Linux Kernel
Subject: git pre-commit hook running checkpatch.pl

I've written a git pre-commit[1] hook which stops any commits happening if
checkpatch.pl reports problems with the patch. Any comments?

[1] http://www.fluff.org/ben/linux/githooks/pre-commit

--
Ben

Q: What's a light-year?
A: One-third less calories than a regular year.



リンク切れに備えて、直接はっておこう

#!/bin/sh
#
# pre-commit hook to run check-patch on the output and stop any commits
# that do not pass. Note, only for git-commit, and not for any of the
# other scenarios
#
# Copyright 2010 Ben Dooks,

if git rev-parse --verify HEAD 2>/dev/null >/dev/null
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

git diff --cached $against -- | ./scripts/checkpatch.pl --no-signoff -