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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user