From 184137770b6973743533b2eeb74d8e91bec2a87b Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 19 Jul 2026 19:25:38 -1000 Subject: Keep the version fallback in shallow builds A checkout without tags made `git describe` fail and the empty result overwrote the fallback, so CI release binaries carried no version at all. The release workflow now also fetches tags so a tag build stamps its exact version. --- source/gen-version.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/gen-version.sh b/source/gen-version.sh index 23d0d0b..fb7d459 100755 --- a/source/gen-version.sh +++ b/source/gen-version.sh @@ -9,10 +9,12 @@ V=$1 OUT=${2:-VERSION} -# Prefer `git describe` when run at the top of the cgit working tree. +# Prefer `git describe` when run at the top of the cgit working tree, +# keeping the fallback when it fails, as in a shallow tagless clone. if test "$(git rev-parse --git-dir 2>/dev/null)" = '.git' then - V=$(git describe --abbrev=4 HEAD 2>/dev/null) + D=$(git describe --abbrev=4 HEAD 2>/dev/null) + test -n "$D" && V=$D fi new="CGIT_VERSION = $V" -- cgit v2.8.0