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

This commit is contained in:
Daniel Eklöf 2019-11-24 13:59:33 +01:00
parent e333bd2176
commit 34f699657a
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 "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)
cd "${src_dir}"
git_version=$(git describe --always --tags)