From 93911d52a8db7a8ec283d2b8e386a00a0ccdde09 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Mon, 1 Sep 2025 12:51:06 +0200 Subject: [PATCH] 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 --- tools/checkpatch.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/checkpatch.sh b/tools/checkpatch.sh index 594a139ff2b..584f8f66a87 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"