]> granicus.if.org Git - mutt/commitdiff
Minor tweaks to the version.sh fixes from last commit.
authorKevin McCarthy <kevin@8t8.us>
Wed, 13 Dec 2017 02:17:10 +0000 (18:17 -0800)
committerKevin McCarthy <kevin@8t8.us>
Wed, 13 Dec 2017 02:17:10 +0000 (18:17 -0800)
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.

version.sh

index 5b3b222ef2038a5c95f31ee7020801b39f45bbcf..45dac50bc22920e7ee759b6b183396630ac9f0b6 100644 (file)
@@ -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})"