summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2022-07-10 14:58:40 +0200
committerKevin McCarthy <kevin@8t8.us>2022-07-28 12:56:28 -0700
commit135fb67e224f9b2397eafdd02e86a409b7a4642c (patch)
tree75e223cfe8d7060c3d6db12015fe53e934717266
parent607efef70b0cbc1dca72487e4d7d5e01e10582d7 (diff)
version.sh: fix robustness on git failure
for instance, with untrusted directory under sudo. Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
-rw-r--r--version.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/version.sh b/version.sh
index f81b71eb..6d87b31f 100644
--- a/version.sh
+++ b/version.sh
@@ -15,7 +15,9 @@ 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 [ $distance -eq 0 ]; then
+[ x = "x$distance" ] && exec cat VERSION
+
+if [ 0 -eq "$distance" ]; then
distance=
else
distance="+$distance"