5 versionglob="[0-9].[0-9]*.[0-9]*"
8 if ! git describe --exact-match --match "$versionglob" "$commit" 2>/dev/null; then
9 if git merge-base --is-ancestor "$commit" origin/master; then
10 # x.(y+1).0.preTIMESTAMP, where x.y.z is the newest version that does not contain $commit
11 v=$(git tag | grep -vFf <(git tag --contains "$commit") | sort -Vr | head -n1 | perl -pe 's/\.(\d+)\.\d+/".".($1+1).".0"/e')
13 # x.y.(z+1).preTIMESTAMP, where x.y.z is the latest released ancestor of $commit
14 v=$(git describe --abbrev=0 --match "$versionglob" "$commit" | perl -pe 's/(\d+)$/$1+1/e')
16 isodate=$(TZ=UTC git log -n1 --format=%cd --date=iso "$commit")
17 ts=$(TZ=UTC date --date="$isodate" "+%Y%m%d%H%M%S")
18 echo "${v}${devsuffix}${ts}"