DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [dpdk-dev] [PATCH] devtools: fix version search with git < 2.7.0
Date: Tue,  5 Sep 2017 00:05:32 +0200	[thread overview]
Message-ID: <20170904220532.10175-1-thomas@monjalon.net> (raw)

The script git-log-fixes.sh (used in check-git-log.sh) looks
for git tags to find the version where a bug is introduced.

In DPDK 17.08, the script has been fixed to ignore tags from
non current branch.
It was using the option --merged which was introduced in git 2.7.0.

As git 2.7.0 is not so old, a fallback is provided for some years.

The fallback is replacing the tag --merged option by a branch filter.
If the tag is found in the branch, the branch name is replaced
by the tag.

This script could be improved to allow using another reference branch,
instead of hard coding HEAD branch (the current one).

Fixes: 26857dabb3c9 ("devtools: ignore non merged tags for backport")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 devtools/git-log-fixes.sh | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 580068741..cd5cf8939 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -66,7 +66,16 @@ range="$*"
 # get major release version of a commit
 commit_version () # <hash>
 {
-	tag=$(git tag -l --contains $1 --merged | head -n1)
+	# use current branch as history reference
+	local refbranch=$(git rev-parse --abbrev-ref HEAD)
+	local tag=$( (git tag -l --contains $1 --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
+			git branch $refbranch --contains $t |
+			sed "s,.\+,$t,"
+		done) |
+		head -n1)
 	if [ -z "$tag" ] ; then
 		# before -rc1 tag of release in progress
 		make showversion | cut -d'.' -f-2
-- 
2.14.1

             reply	other threads:[~2017-09-04 22:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04 22:05 Thomas Monjalon [this message]
2017-09-15  9:24 ` [dpdk-dev] [dpdk-stable] " Nélio Laranjeiro
2017-09-22 13:41   ` 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=20170904220532.10175-1-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).