forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkpatch.sh
executable file
·42 lines (36 loc) · 906 Bytes
/
checkpatch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
DIR="${BASH_SOURCE%/*}"
source "$DIR/checkpatch_inc.sh"
hash $CHECKPATCH 2>/dev/null ||
{ echo >&2 "Could not find checkpatch.pl, aborting"; exit 1; }
usage() {
SCR=$(basename "$0")
echo "Usage: $SCR [--working] Check working area"
echo " $SCR <commit>... Check specific commit(s)"
echo " $SCR --diff <commit1> <commit2> Check diff commit1...commit2"
echo " $SCR --cached Check staging area"
echo " $SCR --help This help"
exit 1
}
op=${1:---working}
case "$op" in
--cached)
echo "Checking staging area: "
checkstaging
;;
--diff)
echo "Checking diff (diff $1...$2)"
checkdiff "$2" "$3"
;;
--working)
echo "Checking working area: "
checkworking
;;
--help|-h)
usage
;;
*)
echo "Checking commit(s):"
for c in $*; do checkpatch $c; done
;;
esac