Use `hg id -r .` to remove the working dir from the distance, and
compare this distance with 1 instead of 0 because we always get
a tagging commit in addition to the tagged commit.
This now matches the logic inside hg.sr.ht/.builds/alpine.yml
---
I'm not even sure how this ever worked correctly? Am I missing
something?
pkgkit | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pkgkit b/pkgkit
index 4afc8e9..a3f21c1 100755
--- a/pkgkit
+++ b/pkgkit
@@ -182,10 +182,10 @@ print_pkgver() {
fi
elif [ -d .hg ]
then
- pkgver=$(hg id -T '{latesttag}')
- if [ "$(hg id -T '{latesttagdistance}')" -ne 0 ]
+ pkgver=$(hg id -r . -T '{latesttag}')
+ if [ "$(hg id -r . -T '{latesttagdistance}')" -ne 1 ]
then
- pkgver="$(hg id -T '{latesttag}_hg{sub("-", "", date|shortdate)}')"
+ pkgver="$(hg id -r . -T '{latesttag}_hg{sub("-", "", date|shortdate)}')"
fi
else
pkgver=unknown_0000
--
2.34.1