Commit | Line | Data |
---|---|---|
de800f52 CB |
1 | #!/bin/sh |
2 | # | |
ab5be9fa | 3 | # Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com> |
de800f52 | 4 | # |
ab5be9fa | 5 | # SPDX-License-Identifier: GPL-2.0-only |
de800f52 | 6 | # |
de800f52 CB |
7 | |
8 | # Install the checkpatch pre-commit hook. | |
9 | ||
10 | DIR="$( cd "$( dirname "$0" )" && pwd )" | |
11 | ||
12 | PRECOMMIT_HOOK="../.git/hooks/pre-commit" | |
13 | PRECOMMIT_SCRIPT="checkpatch-hook" | |
14 | CHECKPATCH_CONF=".checkpatch.conf" | |
15 | ||
16 | if [ -f $PRECOMMIT_HOOK ]; | |
17 | then | |
18 | echo "File $PRECOMMIT_HOOK already exists. Aborting." | |
19 | exit 1 | |
20 | else | |
21 | ln -s $DIR/$PRECOMMIT_SCRIPT $PRECOMMIT_HOOK | |
22 | fi | |
23 | ||
24 | if [ -f ../$CHECKPATCH_CONF ]; | |
25 | then | |
26 | echo "File ../$CHECKPATCH_CONF already exists. Aborting." | |
27 | exit 1 | |
28 | else | |
29 | ln -s $DIR/$CHECKPATCH_CONF ../$CHECKPATCH_CONF | |
30 | fi | |
31 | ||
32 | echo "Checkpatch pre-commit hook successfully installed!" |