diff --git a/lib.sh b/lib.sh index c66f12c..600123f 100644 --- a/lib.sh +++ b/lib.sh @@ -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 }