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

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


The following commit(s) were added to refs/heads/master by this push:
     new 93911d52a8 tools/checkpatch.sh: check format for all commits in patch
93911d52a8 is described below

commit 93911d52a8db7a8ec283d2b8e386a00a0ccdde09
Author: raiden00pl <[email protected]>
AuthorDate: Mon Sep 1 12:51:06 2025 +0200

    tools/checkpatch.sh: check format for all commits in patch
    
    If more than one commit is present in the patch, the commit format
    must be checked separately for each commit in patch, otherwise not
    all errors are detected.
    
    Signed-off-by: raiden00pl <[email protected]>
---
 tools/checkpatch.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/tools/checkpatch.sh b/tools/checkpatch.sh
index 594a139ff2..584f8f66a8 100755
--- a/tools/checkpatch.sh
+++ b/tools/checkpatch.sh
@@ -334,15 +334,23 @@ check_msg() {
   fi
 
   if (( $num_lines < $min_num_lines && $signedoffby_found == 1 )); then
-      echo "Missing git commit message."
-      fail=1
+    echo "Missing git commit message"
+    fail=1
   fi
 }
 
 check_commit() {
   if [ $message != 0 ]; then
-    msg=`git show -s --format=%B $1`
-    check_msg <<< "$msg"
+    # check each commit format separately if this is a series of commits
+    if [[ $1 =~  HEAD ]]; then
+      for commit in $(git rev-list --no-merges $1); do
+        msg=`git show -s --format=%B $commit`
+        check_msg <<< "$msg"
+      done
+    else
+      msg=`git show -s --format=%B $1`
+      check_msg <<< "$msg"
+    fi
   fi
   diffs=`git diff $1`
   check_ranges <<< "$diffs"

Reply via email to