At 19:37 -0800 10 Dec 2017, "Kevin J. McCarthy" <ke...@8t8.us> wrote:
Sorry things have been so quiet.  I've been pretty busy on other stuff,
but what time I have had available has been working on migrating Mutt to
git.

Nice. As someone who's been building mutt from a git clone for years, this is definitely welcome news to me.

Based on my experience in that time, I'd recommend not relying on `git describe` to generate the version string. As shown in the link below, it can sometimes give very strange results. The patch here modifies version.sh to avoid this use, I have been using this method for about a year now (since shortly after I sent the message at that URL).

This patch should be applicable by sending this message through `git am --scissors`.

------ 8< --------

In some cases `git describe` gives bizarre results (see URL below),
instead get the highest version-numbered tag contained in HEAD then
count the number of commits that aren't included in it.

https://public-inbox.org/git/20161205232712.ga23...@pug.qqx.org/
---
version.sh | 31 ++++++++-----------------------
1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/version.sh b/version.sh
index 4bf5fdf2c..5b3b222ef 100644
--- a/version.sh
+++ b/version.sh
@@ -9,28 +9,13 @@ srcdir=`dirname "$0"` && cd "$srcdir" || exit 1
# If not, just cat the VERSION file; it contains the latest release number.
[ -d ".git" ] || exec cat VERSION

-# translate release tags into ##.##.## notation
-get_tag () {
-       sed -e 's/mutt-//' -e 's/-rel.*//' | tr - .
-}
-
-get_dist_node() {
-       sed -e 's/.*-rel-//' -e 's/-/ /'
-}
-
-describe=`git describe --tags --long --match 'mutt-*-rel' 2>/dev/null` || exec 
cat VERSION
-
-tag=`echo $describe | get_tag`
-
-set -- `echo $describe | get_dist_node`
-dist="$1"
-node="$2"
-
-if [ $dist -eq 0 ]; then
-       dist=
+latesttag="$(git tag --merged=HEAD --list 'mutt-*-rel' | tr - . | sort -Vr | head 
-n1 | tr . -)"
+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)"
+if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
+  dirty=+
else
-       dist="+$dist"
+  dirty=""
fi
-
-echo "$tag$dist ($node)"
-exit 0
+echo "${version}+${distance} (g${commitid}${dirty})"
--
2.15.1.426.g49b39d2297

Attachment: signature.asc
Description: PGP signature

Reply via email to