Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve git tag resolution #143

Merged
merged 1 commit into from
Mar 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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