test mbuf attach
[dpdk.git] / devtools / git-log-fixes.sh
index 3bf412e..6d468d6 100755 (executable)
@@ -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 () # <hash>
 {
-       tag=$(git tag -l --contains $1 | 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
@@ -113,10 +94,23 @@ stable_tag () # <hash>
        fi
 }
 
+# print a marker for fixes tag presence
+fixes_tag () # <hash>
+{
+        if git log --format='%b' -1 $1 | grep -qi '^Fixes: *' ; then
+                echo 'F'
+        else
+                echo '-'
+        fi
+}
+
 git log --oneline --reverse $range |
 while read id headline ; do
        origins=$(origin_filter $id)
-       [ -n "$origins" ] || echo "$headline" | grep -q fix || continue
+       stable=$(stable_tag $id)
+       fixes=$(fixes_tag $id)
+       [ "$stable" = "S" ] || [ "$fixes" = "F" ] || [ -n "$origins" ] || \
+               echo "$headline" | grep -q fix || continue
        version=$(commit_version $id)
        if [ -n "$origins" ] ; then
                origver="$(origin_version $origins)"
@@ -126,6 +120,5 @@ while read id headline ; do
        else
                origver='N/A'
        fi
-       stable=$(stable_tag $id)
-       printf '%s %7s %s %s (%s)\n' $version $id $stable "$headline" "$origver"
+       printf '%s %7s %s %s %s (%s)\n' $version $id $stable $fixes "$headline" "$origver"
 done