Update from upstream to 2.4.0 version
[platform/core/security/tef-optee_os.git] / scripts / checkpatch_inc.sh
1 #!/bin/bash
2
3 CHECKPATCH="${CHECKPATCH:-checkpatch.pl}"
4 # checkpatch.pl will ignore the following paths
5 CHECKPATCH_IGNORE=$(echo core/lib/lib{fdt,tomcrypt} lib/lib{png,utils,zlib} \
6                 core/arch/arm/plat-ti/api_monitor_index.h)
7 _CP_EXCL=$(for p in $CHECKPATCH_IGNORE; do echo ":(exclude)$p" ; done)
8
9 function _checkpatch() {
10                 $CHECKPATCH --quiet --ignore FILE_PATH_CHANGES \
11                                 --ignore GERRIT_CHANGE_ID --no-tree -
12 }
13
14 function checkpatch() {
15                 git show --oneline --no-patch $1
16                 git format-patch -1 $1 --stdout -- $_CP_EXCL . | _checkpatch
17 }
18
19 function checkstaging() {
20                 git diff --cached -- . $_CP_EXCL | _checkpatch
21 }
22
23 function checkworking() {
24                 git diff -- . $_CP_EXCL | _checkpatch
25 }
26
27 function checkdiff() {
28                 git diff $1...$2 -- . $_CP_EXCL | _checkpatch
29 }
30