doc: Use git describe --long, and accept 0 or 1 distance to tag as the release

This commit is contained in:
Gabriel Ferreira
2024-07-26 15:41:49 +02:00
parent 66b6653a40
commit 4597de8219

View File

@@ -137,22 +137,27 @@ fi
outf="doc/ns3_html_theme/static/ns3_version.js" outf="doc/ns3_html_theme/static/ns3_version.js"
# Distance from last tag # 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-159-xxx' (if we are at a distance from the last release tag) or
# 'ns-3.29' if we are at the tag. # '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 if [ $distance -eq 1 ] | [ $distance -eq 0 ]; then
version=`git describe HEAD --tags | cut -d '-' -f 2` version=`git describe HEAD --tags --long | cut -d '-' -f 2`
say "at version $version" say "at version $version"
elif [ $tag -eq 0 ]; then
distance=0
# version previously set
vers_href=
elif [ $tag -eq 1 ]; then elif [ $tag -eq 1 ]; then
distance=1 distance=1
# version previously set # version previously set
vers_href= vers_href=
else 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 # Check for uncommitted changes
changes=0 changes=0
if [ "$(git status --porcelain)" ]; then if [ "$(git status --porcelain)" ]; then