You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/04/16 09:13:15 UTC

[incubator-nuttx] branch master updated: tools/checkpatch.sh: enhance added files judgement with +++ at the line beginning

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 773f540  tools/checkpatch.sh: enhance added files judgement with +++ at the line beginning
773f540 is described below

commit 773f540d747c8ee6c5f56261395f7b4634acbbaa
Author: liuhaitao <li...@xiaomi.com>
AuthorDate: Thu Apr 16 15:18:24 2020 +0800

    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 <li...@xiaomi.com>
---
 tools/checkpatch.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/checkpatch.sh b/tools/checkpatch.sh
index 3fbc559..18a9848 100755
--- a/tools/checkpatch.sh
+++ b/tools/checkpatch.sh
@@ -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]} "