Skip to content

Commit

Permalink
Merge pull request #143 from keithc-ca/tag
Browse files Browse the repository at this point in the history
Improve git tag resolution
  • Loading branch information
pshipton authored Mar 22, 2019
2 parents 3cd1a58 + 7f76ddc commit 633c125
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions closed/autoconf/custom-hook.m4
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,18 @@ AC_DEFUN_ONCE([OPENJ9_PLATFORM_SETUP],
AC_DEFUN_ONCE([OPENJDK_VERSION_DETAILS],
[
OPENJDK_SHA=`git -C $TOPDIR rev-parse --short HEAD`
# Find first rev tagged by jdk-11* but not containing "_openj9"
LAST_TAGGED_SHA=`git -C $TOPDIR rev-list --exclude="*_openj9*" --tags="jdk-11*" --topo-order --max-count=1 2>/dev/null`
if test "x$LAST_TAGGED_SHA" != x ; then
# Choose the latest tag when there is more than one for the same SHA.
OPENJDK_TAG=`git -C $TOPDIR tag --points-at "$LAST_TAGGED_SHA" | grep '+' | sort -V | tail -1`
else
OPENJDK_TAG=
# Iterate over the tags with acceptable names, then select the nearest ancestor.
OPENJDK_TAG=
for tag in `git -C $TOPDIR tag --list "jdk-11*+*" | sed -e "/_openj9/d" -e "s:^:refs/tags/:"` ; do
if git -C $TOPDIR merge-base --is-ancestor $tag HEAD ; then
if test x$OPENJDK_TAG = x || git -C $TOPDIR merge-base --is-ancestor $OPENJDK_TAG $tag ; then
OPENJDK_TAG=$tag
fi
fi
done
if test x$OPENJDK_TAG != x ; then
# Choose the latest tag when there is more than one for the same commit.
OPENJDK_TAG=`git -C $TOPDIR tag --points-at $OPENJDK_TAG | grep "jdk-11.*+" | grep -v _openj9 | sort -V | tail -1`
fi
AC_SUBST(OPENJDK_SHA)
AC_SUBST(OPENJDK_TAG)
Expand Down

0 comments on commit 633c125

Please sign in to comment.