Extras: Add a checkpatch git pre-commit hook
[lttng-tools.git] / extras / install-checkpatch-hook
... / ...
CommitLineData
1#!/bin/sh
2#
3# Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
4#
5# This program is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License, version 2 only, as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12# more details.
13#
14# You should have received a copy of the GNU General Public License along with
15# this program; if not, write to the Free Software Foundation, Inc., 51
16# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18# Install the checkpatch pre-commit hook.
19
20DIR="$( cd "$( dirname "$0" )" && pwd )"
21
22PRECOMMIT_HOOK="../.git/hooks/pre-commit"
23PRECOMMIT_SCRIPT="checkpatch-hook"
24CHECKPATCH_CONF=".checkpatch.conf"
25
26if [ -f $PRECOMMIT_HOOK ];
27then
28 echo "File $PRECOMMIT_HOOK already exists. Aborting."
29 exit 1
30else
31 ln -s $DIR/$PRECOMMIT_SCRIPT $PRECOMMIT_HOOK
32fi
33
34if [ -f ../$CHECKPATCH_CONF ];
35then
36 echo "File ../$CHECKPATCH_CONF already exists. Aborting."
37 exit 1
38else
39 ln -s $DIR/$CHECKPATCH_CONF ../$CHECKPATCH_CONF
40fi
41
42echo "Checkpatch pre-commit hook successfully installed!"
This page took 0.032889 seconds and 4 git commands to generate.