forked from nuttx/nuttx-update
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>
This commit is contained in:
parent
9284770f75
commit
c998a2c9bf
1 changed files with 9 additions and 2 deletions
|
@ -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:"
|
||||
|
@ -122,8 +124,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"
|
||||
}
|
||||
|
@ -146,6 +150,9 @@ while [ ! -z "$1" ]; do
|
|||
-f )
|
||||
check=check_file
|
||||
;;
|
||||
-m )
|
||||
message=1
|
||||
;;
|
||||
-g )
|
||||
check=check_commit
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue