All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: bruce.richardson@intel.com
Cc: dev@dpdk.org
Subject: [PATCH] scripts: fix commit check of first word
Date: Tue,  5 Jul 2016 17:54:26 +0200	[thread overview]
Message-ID: <1467734066-18240-1-git-send-email-thomas.monjalon@6wind.com> (raw)

The first word of each commit message is checked.
But when the commit range was greater than 1, only the latest commit
was checked.
It is fixed by checking each commit separately.

Fixes: 9c24780f0d5e ("scripts: check first word of commit messages")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 scripts/check-git-log.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/check-git-log.sh b/scripts/check-git-log.sh
index 7d2c7ee..c7fc0e4 100755
--- a/scripts/check-git-log.sh
+++ b/scripts/check-git-log.sh
@@ -49,6 +49,7 @@ fi
 
 range=${1:-origin/master..}
 
+commits=$(git log --format='%h' $range)
 headlines=$(git log --format='%s' $range)
 bodylines=$(git log --format='%b' $range)
 tags=$(git log --format='%b' $range | grep -i -e 'by *:' -e 'fix.*:')
@@ -115,9 +116,10 @@ bad=$(echo "$bodylines" | grep -v '^Fixes:' | awk 'length>75 {print}' | sed 's,^
 [ -z "$bad" ] || printf "Line too long:\n$bad\n"
 
 # check starting commit message with "It"
-bad=$(echo "$bodylines" | head -n1 | grep -E --color=always \
-	-ie '^It ' \
-	| sed 's,^,\t,')
+bad=$(for commit in $commits ; do
+	firstbodyline=$(git log --format='%b' -1 $commit | head -n1)
+	echo "$firstbodyline" | grep --color=always -ie '^It '
+done | sed 's,^,\t,')
 [ -z "$bad" ] || printf "Wrong beginning of commit message:\n$bad\n"
 
 # check tags spelling
-- 
2.7.0

             reply	other threads:[~2016-07-05 15:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 15:54 Thomas Monjalon [this message]
2016-07-05 16:25 ` [PATCH] scripts: fix commit check of first word Bruce Richardson
2016-07-10 14:34   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467734066-18240-1-git-send-email-thomas.monjalon@6wind.com \
    --to=thomas.monjalon@6wind.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.