From b48717e6d0c8f71ed11915b62da8031cf55f9c0c Mon Sep 17 00:00:00 2001 From: "Cameron Armstrong (Nightfox)" Date: Sun, 8 Nov 2026 01:47:49 +0800 Subject: [PATCH] Amiga: only take the bundle version from an exact release tag json-c tags releases on json-c-0.NN branches that are never merged back to master, so `git describe --tags` from master finds the last release tagged on master itself (0.17) and the readme claimed that version. Use the tag only when HEAD is exactly on it, otherwise use the JSON_C_VERSION from json_c_version.h plus the short commit hash. Also terminate the sed `p` command with `;` before `}` so the version extraction works with BSD/macOS sed. Co-Authored-By: Claude Opus 5.5 --- amiga/package-amiga.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/amiga/package-amiga.sh b/amiga/package-amiga.sh index ac72155..cc05187 100755 --- a/amiga/package-amiga.sh +++ b/amiga/package-amiga.sh @@ -34,14 +34,16 @@ rm -rf "$_lha_probe" # OS gets staged under its own directory. rm -rf "$DIST"; mkdir -p "$STAGE/json-c" -# Extract the version from either a release tag, or the dev version + abbreviated commit hash -GIT_DESCR=$(git describe --tags --always) -if [[ "$GIT_DESCR" == json-c-* ]] ; then +# Extract the version from either a release tag, or the dev version + abbreviated commit hash. +# Only use a tag when HEAD is exactly on it: release tags live on release +# branches, so the nearest *reachable* tag is often an old release. +GIT_TAG=$(git describe --tags --exact-match 2>/dev/null) +if [[ "$GIT_TAG" == json-c-* ]] ; then # e.g. 0.19-20260627 - JSON_C_VERS=${GIT_DESCR#json-c-} + JSON_C_VERS=${GIT_TAG#json-c-} else # e.g. 0.19.99-09e45f6 - JSON_C_VERS=$(sed -ne'/define JSON_C_VERSION / { s/"$//; s/.*"//; p }' "${ROOT}/json_c_version.h")-${GIT_DESCR} + JSON_C_VERS=$(sed -ne'/define JSON_C_VERSION / { s/"$//; s/.*"//; p; }' "${ROOT}/json_c_version.h")-$(git rev-parse --short HEAD) fi sed -e"s/VERSION/${JSON_C_VERS}/" "$AMIGA_DIR/json-c.readme.template" > "$STAGE/json-c/json-c.readme"