From fe1dba18d2f5f7eca661867c65c9d2107628da6e Mon Sep 17 00:00:00 2001 From: darksaid98 Date: Sun, 13 Jul 2025 11:36:53 +0200 Subject: [PATCH] fix(graalvm): allow branch switching --- graalvm/entrypoint.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/graalvm/entrypoint.sh b/graalvm/entrypoint.sh index e1d707e..6c49037 100644 --- a/graalvm/entrypoint.sh +++ b/graalvm/entrypoint.sh @@ -119,6 +119,24 @@ perform_git_update() { fi echo "Updating local files to match remote branch..." + + # Switch branches if necessary + local current_branch=$(git branch --show-current 2>/dev/null || echo "") + + if [ "$current_branch" != "$branch" ]; then + echo "Switching from branch '$current_branch' to '$branch'..." + + # Check if local branch exists + if git show-ref --verify --quiet "refs/heads/$branch"; then + echo "Local branch '$branch' exists, checking out..." + git checkout "$branch" + else + echo "Creating and checking out new local branch '$branch'..." + git checkout -b "$branch" "origin/$branch" + fi + fi + + # Deploy changes git reset --hard "origin/$branch" # Get latest commit info for logging