btstack/tool/get_git_version.sh

18 lines
248 B
Bash
Raw Normal View History

#!/usr/bin/env sh
# get tag from git
tag=`git tag --points-at HEAD`
# get git version
commit=`git rev-parse --short HEAD`
# use tag if available
if [ -z "$tag" ]
then
version=${commit}
else
version=${tag}-${commit}
fi
echo "${version}"