Fix empty version when the repo has no tags

The describe|sed pipeline took sed's exit status, so with no tags
version() returned an empty string instead of the commit date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 08:40:59 -07:00
co-authored by Claude Opus 5.5
parent d039484a4a
commit 1a86589840
+5 -2
View File
@@ -17,8 +17,11 @@ URL="http://localhost:8470"
# The version, worked out the way CoreDesktop's `sibling` shows it: the
# latest tag, or else the date and short hash of the latest commit.
version() {
git -C "$SUPERMARKET_REPO" describe --tags 2> /dev/null \
| sed -E 's/-([0-9]+)-g[0-9a-f]+$/+\1/' && return
local tag
if tag="$(git -C "$SUPERMARKET_REPO" describe --tags 2> /dev/null)"; then
sed -E 's/-([0-9]+)-g[0-9a-f]+$/+\1/' <<< "$tag"
return
fi
git -C "$SUPERMARKET_REPO" log -1 --date=format:%Y.%m.%d --format='%cd (%h)' 2> /dev/null || echo dev
}