fix: make generate.sh work with git worktrees

This commit is contained in:
Jan 2025-04-20 23:36:56 +02:00
parent da90bbd356
commit ba4cb85639
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C

View File

@ -46,13 +46,18 @@ function install_premake {
chmod +x build/premake5 chmod +x build/premake5
} }
# Go to repository root function expect_inside_git_repository {
cd "$(dirname "$0")" || exit 2 inside_git_repo="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
if [ ! -d ".git" ] && [ ! "$inside_git_repo" ]; then
if [[ ! -d ".git" ]]; then
echo "You must clone the OpenAssetTools repository using 'git clone'. Please read README.md." >&2 echo "You must clone the OpenAssetTools repository using 'git clone'. Please read README.md." >&2
exit 1 exit 1
fi fi
}
# Go to repository root
cd "$(dirname "$0")" || exit 2
expect_inside_git_repository
PREMAKE_BIN='' PREMAKE_BIN=''
if [[ -z "$PREMAKE_NO_GLOBAL" ]] && [[ -x "$(command -v premake5)" ]]; then if [[ -z "$PREMAKE_NO_GLOBAL" ]] && [[ -x "$(command -v premake5)" ]]; then