[dpdk-dev] scripts: fix commit check of first word
Commit Message
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(-)
Comments
On Tue, Jul 05, 2016 at 05:54:26PM +0200, Thomas Monjalon wrote:
> 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>
> ---
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> > 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>
>
> Tested-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Applied
@@ -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