Commit a4d08d25 authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

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.
parent 8648db83
......@@ -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})"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment