[dpdk-dev] [PATCH] devtools: make commits with stable tag outstanding

Thomas Monjalon thomas.monjalon at 6wind.com
Fri Mar 10 12:13:28 CET 2017


2017-02-23 10:49, Yuanhan Liu:
> So that, as a stable maintainer while picking commits to a stable release,
> I could pay less attention to those have it and pay more attention to those
> don't have it.

Good idea 

> +	stable="-"
> +	git show $id | grep -qi 'Cc: .*stable at dpdk.org' && stable="S"

Instead of git show, it is preferrable to get only the message content:
	git log --format='%b' -1 $id

The regex may miss a Cc: without space, and may match a Cc in the middle
of a sentence.
I suggest this one:
	grep -qi '^Cc: *stable at dpdk.org'

The script is written in the style "set -e" so it must be avoided to have
a "false" statement not catched.
It can be done in 2 ways:

1/
git log --format='%b' -1 $id | grep -qi '^Cc: *stable at dpdk.org' && stable='S' || stable='-'

2/
if git log --format='%b' -1 $id | grep -qi '^Cc: *stable at dpdk.org' ; then
	stable='S'
else
	stable='-'
endif

We can also move it in a function in order to keep only the logic in the
"main" block:
	stable=$(stable_tag $id)

# print a marker for stable tag presence
stable_tag () # <hash>
{
	if git log --format='%b' -1 $id | grep -qi '^Cc: *stable at dpdk.org' ; then
		echo 'S'
	else
		echo '-'
	endif
}



More information about the dev mailing list