X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=devtools%2Fgit-log-fixes.sh;h=e37ee2260019260745dcaee106b3eb0b663a69f6;hb=c039a73fc62040d5bc5811a8dae367daf7198646;hp=5800687419c881eae36c119163f9847c662c6dba;hpb=26857dabb3c91031beb2faab6237969951341a30;p=dpdk.git diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh index 5800687419..e37ee22600 100755 --- a/devtools/git-log-fixes.sh +++ b/devtools/git-log-fixes.sh @@ -1,34 +1,6 @@ #! /bin/sh -e - -# BSD LICENSE -# +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2016 6WIND S.A. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of 6WIND S.A. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. print_usage () { @@ -66,7 +38,16 @@ range="$*" # get major release version of a commit commit_version () # { - 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