generate-version: handle builds that aren't git clones

This commit is contained in:
Daniel Eklöf 2019-11-24 14:00:21 +01:00
parent 199a7ccd21
commit 6c12ea3811
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -10,7 +10,7 @@ out_file=${3}
# echo "source directory: ${src_dir}" # echo "source directory: ${src_dir}"
# echo "output file: ${out_file}" # echo "output file: ${out_file}"
if command -v git > /dev/null; then if command -v git > /dev/null && git rev-parse --is-inside-work-tree 2> /dev/null; then
workdir=$(pwd) workdir=$(pwd)
cd "${src_dir}" cd "${src_dir}"
git_version=$(git describe --always --tags) git_version=$(git describe --always --tags)