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.
# 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
# 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)"