Files
wowlet/contrib/shell/git-utils.bash
T
2025-02-20 18:38:56 +01:00

27 lines
540 B
Bash

#!/usr/bin/env bash
git_root() {
git rev-parse --show-toplevel 2> /dev/null
}
git_head_version() {
local recent_tag
if recent_tag="$(git describe --exact-match HEAD 2> /dev/null)"; then
echo "${recent_tag%-rc}"
else
git rev-parse --short=12 HEAD
fi
}
is_release() {
local recent_tag
if recent_tag="$(git describe --exact-match HEAD 2> /dev/null)"; then
if [[ "$recent_tag" == *"-rc" ]]; then
echo -n "0"
fi
echo -n "1"
else
echo -n "0"
fi
}