Commit 8648db83 authored by Aaron Schrab's avatar Aaron Schrab Committed by Kevin J. McCarthy

Change version.sh to manually compute version and distance.

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/[email protected]/
parent 7b65f780
......@@ -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})"
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