[v2,1/2] devtools: fix version pattern for fix search

Message ID 20210630063416.9550-1-xuemingl@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/2] devtools: fix version pattern for fix search |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Xueming Li June 30, 2021, 6:34 a.m. UTC
  When scanning fixes from current(HEAD) branch, local tags were included
and reported as version. For example:
  $ git tag --contains <commit_id> --merged
  20.11_backport_202010506   // user tag
  v20.11
  v20.11.1

This patch matches DPDK officail version pattern in search, selects
the most early tag. Official tag pattern: "v<major>.<minor>"

Fixes: 752d8e097ec1 ("scripts: show fixes with release version of bug")
Cc: Thomas Monjalon <thomas@monjalon.net>
Cc: stable@dpdk.org

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 devtools/git-log-fixes.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Thomas Monjalon Aug. 8, 2021, 11:14 a.m. UTC | #1
30/06/2021 08:34, Xueming Li:
> When scanning fixes from current(HEAD) branch, local tags were included
> and reported as version. For example:
>   $ git tag --contains <commit_id> --merged
>   20.11_backport_202010506   // user tag
>   v20.11
>   v20.11.1
> 
> This patch matches DPDK officail version pattern in search, selects
> the most early tag. Official tag pattern: "v<major>.<minor>"
> 
> Fixes: 752d8e097ec1 ("scripts: show fixes with release version of bug")
> Cc: Thomas Monjalon <thomas@monjalon.net>
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>  devtools/git-log-fixes.sh | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
> index 210c8dcf25..153ba5b438 100755
> --- a/devtools/git-log-fixes.sh
> +++ b/devtools/git-log-fixes.sh
> @@ -38,12 +38,13 @@ range="$*"
>  # get major release version of a commit
>  commit_version () # <hash>
>  {
> +	local VER="v*.*"

Which tag is it supposed to match? What would not be matched?
What about something like v19.11.8 ?
What about the above example 20.11_backport_202010506?

>  	# use current branch as history reference
>  	local refbranch=$(git rev-parse --abbrev-ref HEAD)
> -	local tag=$( (git tag -l --contains $1 --merged $refbranch 2>&- ||
> +	local tag=$( (git tag -l "$VER" --contains $1 --sort=creatordate --merged $refbranch 2>&- ||

Why adding "--sort=creatordate" ?
It is not mentioned in the commit log.

>  		# tag --merged option has been introduced in git 2.7.0
>  		# below is a fallback in case of old git version
> -		for t in $(git tag -l --contains $1) ; do
> +		for t in $(git tag -l "$VER" --contains $1) ; do
>  			git branch $refbranch --contains $t |
>  			sed "s,.\+,$t,"
>  		done) |
  
Xueming Li Aug. 9, 2021, 3:32 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Sunday, August 8, 2021 7:15 PM
> To: Xueming(Steven) Li <xuemingl@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Christian Ehrhardt <christian.ehrhardt@canonical.com>; david.marchand@redhat.com; Luca
> Boccassi <bluca@debian.org>
> Subject: Re: [dpdk-stable] [PATCH v2 1/2] devtools: fix version pattern for fix search
> 
> 30/06/2021 08:34, Xueming Li:
> > When scanning fixes from current(HEAD) branch, local tags were
> > included and reported as version. For example:
> >   $ git tag --contains <commit_id> --merged
> >   20.11_backport_202010506   // user tag
> >   v20.11
> >   v20.11.1
> >
> > This patch matches DPDK officail version pattern in search, selects
> > the most early tag. Official tag pattern: "v<major>.<minor>"
> >
> > Fixes: 752d8e097ec1 ("scripts: show fixes with release version of
> > bug")
> > Cc: Thomas Monjalon <thomas@monjalon.net>
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> > Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> > ---
> >  devtools/git-log-fixes.sh | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
> > index 210c8dcf25..153ba5b438 100755
> > --- a/devtools/git-log-fixes.sh
> > +++ b/devtools/git-log-fixes.sh
> > @@ -38,12 +38,13 @@ range="$*"
> >  # get major release version of a commit  commit_version () # <hash>
> > {
> > +	local VER="v*.*"
> 
> Which tag is it supposed to match? What would not be matched?
> What about something like v19.11.8 ?
> What about the above example 20.11_backport_202010506?

It matches any tag version like started with "v" and a "." in the middle.
So v19.11.8 matches as at least one "." in the middle.
20.11_backport_202010506 can't match since it not started with "v"

> 
> >  	# use current branch as history reference
> >  	local refbranch=$(git rev-parse --abbrev-ref HEAD)
> > -	local tag=$( (git tag -l --contains $1 --merged $refbranch 2>&- ||
> > +	local tag=$( (git tag -l "$VER" --contains $1 --sort=creatordate --merged $refbranch 2>&- ||
> 
> Why adding "--sort=creatordate" ?
> It is not mentioned in the commit log.

Mentioned a little bit: "select the most early tag"
By default git output tag in alpha order, this makes v19.11 appears earlier than v2.x, that's wrong.

> 
> >  		# tag --merged option has been introduced in git 2.7.0
> >  		# below is a fallback in case of old git version
> > -		for t in $(git tag -l --contains $1) ; do
> > +		for t in $(git tag -l "$VER" --contains $1) ; do
> >  			git branch $refbranch --contains $t |
> >  			sed "s,.\+,$t,"
> >  		done) |
> 
> 
> 
> 
>
  

Patch

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 210c8dcf25..153ba5b438 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -38,12 +38,13 @@  range="$*"
 # get major release version of a commit
 commit_version () # <hash>
 {
+	local VER="v*.*"
 	# use current branch as history reference
 	local refbranch=$(git rev-parse --abbrev-ref HEAD)
-	local tag=$( (git tag -l --contains $1 --merged $refbranch 2>&- ||
+	local tag=$( (git tag -l "$VER" --contains $1 --sort=creatordate --merged $refbranch 2>&- ||
 		# tag --merged option has been introduced in git 2.7.0
 		# below is a fallback in case of old git version
-		for t in $(git tag -l --contains $1) ; do
+		for t in $(git tag -l "$VER" --contains $1) ; do
 			git branch $refbranch --contains $t |
 			sed "s,.\+,$t,"
 		done) |