]> granicus.if.org Git - mutt/commitdiff
Determine latest tag using git describe.
authorKevin McCarthy <kevin@8t8.us>
Mon, 18 Dec 2017 20:55:20 +0000 (12:55 -0800)
committerKevin McCarthy <kevin@8t8.us>
Mon, 18 Dec 2017 20:55:20 +0000 (12:55 -0800)
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.

mkchangelog.sh
version.sh

index fc03a6f433f71cd6e2ecdca65267deb9a5c35e09..9f551012859469971849fa870bdce1696ae91900 100755 (executable)
@@ -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
index 45dac50bc22920e7ee759b6b183396630ac9f0b6..bc850f6c71f033cf1e0311a96914ac5008afa6bd 100644 (file)
@@ -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)"