From ba4cb85639cbcab4abaf1f3c588ad2236c8893d9 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 20 Apr 2025 23:36:56 +0200 Subject: [PATCH] fix: make generate.sh work with git worktrees --- generate.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/generate.sh b/generate.sh index 0e81374d..fdad72f8 100755 --- a/generate.sh +++ b/generate.sh @@ -46,13 +46,18 @@ function install_premake { chmod +x build/premake5 } +function expect_inside_git_repository { + inside_git_repo="$(git rev-parse --is-inside-work-tree 2>/dev/null)" + if [ ! -d ".git" ] && [ ! "$inside_git_repo" ]; then + echo "You must clone the OpenAssetTools repository using 'git clone'. Please read README.md." >&2 + exit 1 + fi +} + # Go to repository root cd "$(dirname "$0")" || exit 2 -if [[ ! -d ".git" ]]; then - echo "You must clone the OpenAssetTools repository using 'git clone'. Please read README.md." >&2 - exit 1 -fi +expect_inside_git_repository PREMAKE_BIN='' if [[ -z "$PREMAKE_NO_GLOBAL" ]] && [[ -x "$(command -v premake5)" ]]; then