From: Kevin McCarthy Date: Wed, 13 Dec 2017 02:17:10 +0000 (-0800) Subject: Minor tweaks to the version.sh fixes from last commit. X-Git-Tag: mutt-1-9-2-rel~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a4d08d25ce8bbc27ccb56e8d9671529588a5fc4d;p=mutt Minor tweaks to the version.sh fixes from last commit. Add back a check for whether the git program exists. Don't show distance if it is zero. Remove the dirty flag. Remove the initial "g" prefix from the commitid. This is added by git describe, but I don't think we need to preserve it. --- diff --git a/version.sh b/version.sh index 5b3b222e..45dac50b 100644 --- a/version.sh +++ b/version.sh @@ -7,15 +7,18 @@ 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" ] || exec cat VERSION +{ [ -d ".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 . -)" 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=+ + +if [ $distance -eq 0 ]; then + distance= else - dirty="" + distance="+$distance" fi -echo "${version}+${distance} (g${commitid}${dirty})" + +echo "${version}${distance} (${commitid})"