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