mutt stable branch with some hacks
1#!/bin/sh
2
3# Switch to directory where this script lives so that further commands are run
4# from the root directory of the source. The script path and srcdir are double
5# quoted to allow the space character to appear in the path.
6srcdir=`dirname "$0"` && cd "$srcdir" || exit 1
7
8# Ensure that we have a repo here.
9# If not, just cat the VERSION file; it contains the latest release number.
10{ [ -r ".git" ] && command -v git >/dev/null 2>&1; } \
11|| exec cat VERSION
12
13latesttag=`git describe --tags --match 'mutt-*-rel' --abbrev=0`
14version=`echo $latesttag | sed -e s/mutt-// -e s/-rel// -e s/-/./g`
15distance=`git rev-list --count $latesttag..`
16commitid=`git rev-parse --short HEAD`
17
18if [ $distance -eq 0 ]; then
19 distance=
20else
21 distance="+$distance"
22fi
23
24echo "${version}${distance} (${commitid})"