From a58eb3e9efef24faf24179f199e9c4f5d1d778a7 Mon Sep 17 00:00:00 2001 From: Krystie Date: Fri, 27 Mar 2026 23:02:04 -0700 Subject: [PATCH] Fix version detection: prioritize exact tag match in genbuild.sh When building from a release tag (e.g. v5.4.1), git describe was finding the nearest ancestor tag (v5.3.8) instead of the exact tag, resulting in version strings like 'v5.3.8-9-gdfb4b22' instead of 'v5.4.1'. Now genbuild.sh tries --exact-match first, falling back to distance-based describe only when not on a tagged commit. --- share/genbuild.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) mode change 100644 => 100755 share/genbuild.sh diff --git a/share/genbuild.sh b/share/genbuild.sh old mode 100644 new mode 100755 index d959877..507e334 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -15,8 +15,13 @@ if [ -e "$(which git)" ]; then # clean 'dirty' status of touched files that haven't been modified git diff >/dev/null 2>/dev/null - # get a string like "v0.6.0-66-g59887e8-dirty" - DESC="$(git describe --dirty 2>/dev/null)" + # Try exact tag match first (when building from a release tag) + DESC="$(git describe --tags --exact-match 2>/dev/null)" + + # If no exact match, fall back to git describe with commit distance + if [ -z "$DESC" ]; then + DESC="$(git describe --tags --dirty 2>/dev/null)" + fi # get a string like "2012-04-10 16:27:19 +0200" TIME="$(git log -n 1 --format="%ci")"