X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=extras%2Fcheckpatch-hook;fp=extras%2Fcheckpatch-hook;h=686815bbef6886f5813fffcfa2c85b3449055f0e;hp=0000000000000000000000000000000000000000;hb=de800f526933f12c0bf521b5d6976d7c6d15af2f;hpb=7a6dd8dde9ea347b5dedd7a712921ca1af1eba50 diff --git a/extras/checkpatch-hook b/extras/checkpatch-hook new file mode 100755 index 000000000..686815bbe --- /dev/null +++ b/extras/checkpatch-hook @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright (C) - 2013 Christian Babeux +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License, version 2 only, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 51 +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# To enable this hook, run the "install-checkpatch-hook" script. + +CHECKPATCH="extras/checkpatch.pl" + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +git diff --cached $against -- | $CHECKPATCH --no-signoff -