From 4597de82194459c70ce136c8e03aae51e26961e0 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Fri, 26 Jul 2024 15:41:49 +0200 Subject: [PATCH] doc: Use `git describe --long`, and accept 0 or 1 distance to tag as the release --- doc/ns3_html_theme/get_version.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/ns3_html_theme/get_version.sh b/doc/ns3_html_theme/get_version.sh index 70c11161b..42fb4259b 100755 --- a/doc/ns3_html_theme/get_version.sh +++ b/doc/ns3_html_theme/get_version.sh @@ -137,22 +137,27 @@ fi outf="doc/ns3_html_theme/static/ns3_version.js" # Distance from last tag -# 'git describe HEAD --tags' will return a string such as either +# 'git describe HEAD --tags --long' will return a string such as either # 'ns-3.29-159-xxx' (if we are at a distance from the last release tag) or # 'ns-3.29' if we are at the tag. -distance=`git describe HEAD --tags | cut -d '-' -f 3- | cut -d '-' -f 1` +distance=`git describe HEAD --tags --long | cut -d '-' -f 3` -if [ $distance -eq 1 ]; then - version=`git describe HEAD --tags | cut -d '-' -f 2` +if [ $distance -eq 1 ] | [ $distance -eq 0 ]; then + version=`git describe HEAD --tags --long | cut -d '-' -f 2` say "at version $version" +elif [ $tag -eq 0 ]; then + distance=0 + # version previously set + vers_href= + elif [ $tag -eq 1 ]; then distance=1 # version previously set vers_href= else - version=`git describe HEAD --tags | cut -d '-' -f 3- | cut -d '-' -f 2 | cut -c 2-` + version=`git describe HEAD --tags --long | cut -d '-' -f 3- | cut -d '-' -f 2 | cut -c 2-` # Check for uncommitted changes changes=0 if [ "$(git status --porcelain)" ]; then