checkpatch: exclude util/crossgcc/patches
[coreboot.git] / util / gitconfig / pre-commit
blob027eec0705f5faa48d7a8e280474d502ac0154b1
1 #!/bin/sh
3 ##
4 ## This file is part of the coreboot project.
5 ##
6 ## Copyright (C) 2015 Patrick Georgi <patrick@georgi-clan.de>
7 ##
8 ## This program is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; version 2 of the License.
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ## GNU General Public License for more details.
18 set -e # -o errexit
19 set -u # -o nounset
21 %MAKE% lint-stable
23 PATCHDIFF=$(git diff --cached --src-prefix=a/ --dst-prefix=b/)
24 if printf "%s\n" "$PATCHDIFF" | grep -q "@@"; then
25 echo
26 echo "Running checkpatch"
27 printf "%s\n" "$PATCHDIFF" | util/lint/lint-007-checkpatch diff