tools/checkpatch.sh: enhance added files judgement with +++ at the line beginning

In https://github.com/apache/incubator-nuttx-apps/pull/179, there is a
removed graphics/littlevgl/lv_symbol_def.patch file whose content would be
treated abnormally and results in errors.

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
This commit is contained in:
liuhaitao
2020-04-16 15:18:24 +08:00
committed by Xiang Xiao
parent 3c829226f9
commit 773f540d74
+2 -2
View File
@@ -56,7 +56,7 @@ check_file() {
check_ranges() {
while read; do
if [[ $REPLY =~ \+\+\+\ (b/)?([^[:blank:]]+).* ]]; then
if [[ $REPLY =~ ^(\+\+\+\ (b/)?([^[:blank:]]+).*)$ ]]; then
if [ "$ranges" != "" ]; then
if [ $range != 0 ]; then
check_file $ranges $path 2>&1
@@ -64,7 +64,7 @@ check_ranges() {
check_file $path 2>&1
fi
fi
path=${BASH_REMATCH[2]}
path=${BASH_REMATCH[3]}
ranges=""
elif [[ $REPLY =~ @@\ -[0-9]+(,[0-9]+)?\ \+([0-9]+,[0-9]+)?\ @@.* ]]; then
ranges+="-r ${BASH_REMATCH[2]} "