checkpatch.sh: add -m option to enable/disable Change-Id check

Defaultly disable Change-Id check in commit message.

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
Change-Id: Ic16f9cc9abc7d27c4e3e6ded27b8e27f2a1e312d
This commit is contained in:
liuhaitao
2021-09-18 17:14:33 +08:00
parent bd6f56907a
commit 905d956ee7
+9 -2
View File
@@ -23,6 +23,7 @@ check=check_patch
fail=0
range=0
spell=0
message=0
usage() {
echo "USAGE: ${0} [options] [list|-]"
@@ -32,6 +33,7 @@ usage() {
echo "-c spell check with codespell(install with: pip install codespell)"
echo "-r range check only (coupled with -p or -g)"
echo "-p <patch file names> (default)"
echo "-m Change-Id check in commit message (coupled with -g)"
echo "-g <commit list>"
echo "-f <file list>"
echo "- read standard input mainly used by git pre-commit hook as below:"
@@ -100,8 +102,10 @@ check_msg() {
}
check_commit() {
msg=`git show -s --format=%B $1`
check_msg <<< "$msg"
if [ $message != 0 ]; then
msg=`git show -s --format=%B $1`
check_msg <<< "$msg"
fi
diffs=`git diff $1`
check_ranges <<< "$diffs"
}
@@ -124,6 +128,9 @@ while [ ! -z "$1" ]; do
-f )
check=check_file
;;
-m )
message=1
;;
-g )
check=check_commit
;;