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.
This commit is contained in:
Regular → Executable
+7
-2
@@ -15,8 +15,13 @@ if [ -e "$(which git)" ]; then
|
|||||||
# clean 'dirty' status of touched files that haven't been modified
|
# clean 'dirty' status of touched files that haven't been modified
|
||||||
git diff >/dev/null 2>/dev/null
|
git diff >/dev/null 2>/dev/null
|
||||||
|
|
||||||
# get a string like "v0.6.0-66-g59887e8-dirty"
|
# Try exact tag match first (when building from a release tag)
|
||||||
DESC="$(git describe --dirty 2>/dev/null)"
|
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"
|
# get a string like "2012-04-10 16:27:19 +0200"
|
||||||
TIME="$(git log -n 1 --format="%ci")"
|
TIME="$(git log -n 1 --format="%ci")"
|
||||||
|
|||||||
Reference in New Issue
Block a user