scripts: don't overwrite generated version if we're not in a git repo

This commit is contained in:
Vaxry 2025-02-05 15:41:54 +00:00
parent 64591c85aa
commit 8a6778f0a0

View File

@ -1,4 +1,13 @@
#!/bin/sh
# if the git directory doesn't exist, don't gather data to avoid overwriting, unless
# the version file is missing altogether (otherwise compiling will fail)
if [[ ! -d ./.git ]]; then
if [[ -f ./src/version.h ]]; then
exit 0
fi
fi
cp -fr ./src/version.h.in ./src/version.h
HASH=${HASH-$(git rev-parse HEAD)}