From: Kevin McCarthy Date: Mon, 18 Dec 2017 20:55:20 +0000 (-0800) Subject: Determine latest tag using git describe. X-Git-Tag: mutt-1-9-3-rel~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80d06b0cccc42571503fe0ab94c61ef267fc3c63;p=mutt Determine latest tag using git describe. Commit 8648db83 relies on `sort -V` which is unavailable on some platforms. Instead just use `git describe` with --abbrev=0 to only output the tag. We still manually compute the distance to avoid the problem mentioned in that commit. Additionally, add Vincent's fix from commit 3b142cea to the stable branch. --- diff --git a/mkchangelog.sh b/mkchangelog.sh index fc03a6f4..9f551012 100755 --- a/mkchangelog.sh +++ b/mkchangelog.sh @@ -5,7 +5,7 @@ # This would generate based on the last update of the ChangeLog, instead: # lrev=$(git log -1 --pretty=format:"%H" ChangeLog) -lrev=$(git tag --merged=HEAD --list 'mutt-*-rel' | tr - . | sort -Vr | head -n1 | tr . -) +lrev=$(git describe --tags --match 'mutt-*-rel' --abbrev=0) # This is a rough approximation of the official ChangeLog format # previously generated by hg. Git doesn't provide enough formatting diff --git a/version.sh b/version.sh index 45dac50b..bc850f6c 100644 --- a/version.sh +++ b/version.sh @@ -7,10 +7,10 @@ srcdir=`dirname "$0"` && cd "$srcdir" || exit 1 # Ensure that we have a repo here. # If not, just cat the VERSION file; it contains the latest release number. -{ [ -d ".git" ] && command -v git >/dev/null 2>&1; } \ +{ [ -e ".git" ] && command -v git >/dev/null 2>&1; } \ || exec cat VERSION -latesttag="$(git tag --merged=HEAD --list 'mutt-*-rel' | tr - . | sort -Vr | head -n1 | tr . -)" +latesttag="$(git describe --tags --match 'mutt-*-rel' --abbrev=0)" version="$(echo $latesttag | sed -e s/mutt-// -e s/-rel// -e s/-/./g)" distance="$(git rev-list --count $latesttag..)" commitid="$(git rev-parse --short HEAD)"