2022-12-20 01:27:55 +00:00
|
|
|
function git_short_hash {
|
|
|
|
short_hash="$(cached git_short_hash)"
|
|
|
|
|
|
|
|
if [ -z "$short_hash" ]; then
|
|
|
|
short_hash="$(git rev-parse --short HEAD)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
output "$short_hash"
|
|
|
|
}
|
|
|
|
|
|
|
|
function git_tag_version {
|
|
|
|
tag="$(cached git_tag_version)"
|
|
|
|
|
|
|
|
if [ -z "$tag" ]; then
|
|
|
|
tag="$(git describe --tags --abbrev=0)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the potential prefix of `v`
|
|
|
|
if [[ $tag =~ ^v[0-9].* ]]; then
|
|
|
|
tag="${tag:1}"
|
|
|
|
fi
|
2022-12-20 01:37:33 +00:00
|
|
|
|
|
|
|
tag="${tag/"-"/"."}"
|
2022-12-20 01:27:55 +00:00
|
|
|
output "$tag"
|
|
|
|
}
|