xref: /optee_os/scripts/checkpatch_inc.sh (revision 1c93c2b5e2da6651371462e0ec7441e070d757bf)
1*1c93c2b5SIgor Opaniuk#!/bin/bash
2*1c93c2b5SIgor Opaniuk
3*1c93c2b5SIgor OpaniukCHECKPATCH=checkpatch.pl
4*1c93c2b5SIgor Opaniuk# checkpatch.pl will ignore the following paths
5*1c93c2b5SIgor OpaniukCHECKPATCH_IGNORE=$(echo core/lib/lib{fdt,tomcrypt} lib/lib{png,utils,zlib})
6*1c93c2b5SIgor Opaniuk_CP_EXCL=$(for p in $CHECKPATCH_IGNORE; do echo ":(exclude)$p" ; done)
7*1c93c2b5SIgor Opaniuk
8*1c93c2b5SIgor Opaniukfunction _checkpatch() {
9*1c93c2b5SIgor Opaniuk		$CHECKPATCH --quiet --ignore FILE_PATH_CHANGES \
10*1c93c2b5SIgor Opaniuk				--ignore GERRIT_CHANGE_ID --no-tree -
11*1c93c2b5SIgor Opaniuk}
12*1c93c2b5SIgor Opaniuk
13*1c93c2b5SIgor Opaniukfunction checkpatch() {
14*1c93c2b5SIgor Opaniuk		git show --oneline --no-patch $1
15*1c93c2b5SIgor Opaniuk		git format-patch -1 $1 --stdout -- $_CP_EXCL . | _checkpatch
16*1c93c2b5SIgor Opaniuk}
17*1c93c2b5SIgor Opaniuk
18*1c93c2b5SIgor Opaniukfunction checkstaging() {
19*1c93c2b5SIgor Opaniuk		git diff --cached -- . $_CP_EXCL | _checkpatch
20*1c93c2b5SIgor Opaniuk}
21*1c93c2b5SIgor Opaniuk
22*1c93c2b5SIgor Opaniukfunction checkworking() {
23*1c93c2b5SIgor Opaniuk		git diff -- . $_CP_EXCL | _checkpatch
24*1c93c2b5SIgor Opaniuk}
25*1c93c2b5SIgor Opaniuk
26*1c93c2b5SIgor Opaniukfunction checkdiff() {
27*1c93c2b5SIgor Opaniuk		git diff $1...$2 -- . $_CP_EXCL | _checkpatch
28*1c93c2b5SIgor Opaniuk}
29*1c93c2b5SIgor Opaniuk
30