generate-version: check for .git directory in *src* dir

Instead of trying to run `git --rev-parse --is-inside-work-tree`,
check if there's a .git directory under the source directory.

This should fix an issue where we incorrectly decided we where in a
foot git clone when we're just a subdirectory under another
repository.
This commit is contained in:
Daniel Eklöf 2020-03-06 22:16:33 +01:00
parent 6af8b52012
commit d68785eb2b
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 && git rev-parse --is-inside-work-tree > /dev/null 2>&1; then if [ -d "${src_dir}/.git" ] && command -v git > /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)