From 16e76d70c9273f9c13cea9fa6f928b666e57289f Mon Sep 17 00:00:00 2001 From: mboehmlaender Date: Thu, 12 Mar 2026 08:07:32 +0000 Subject: [PATCH] fix: validate remote branch exists before clone/reinstall Prevents cryptic git errors on fresh machines or when switching branches. Shows available branches in the error message for easier debugging. Co-Authored-By: Claude Sonnet 4.6 --- install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/install.sh b/install.sh index f0cca41..393471e 100755 --- a/install.sh +++ b/install.sh @@ -412,6 +412,13 @@ done # --- Repository klonen / aktualisieren ---------------------------------------- header "Repository holen (Git)" +# Prüfen ob der gewünschte Branch auf dem Remote existiert +info "Prüfe Branch '$GIT_BRANCH' auf Remote..." +if ! git ls-remote --exit-code --heads "$REPO_URL" "$GIT_BRANCH" &>/dev/null; then + fatal "Branch '$GIT_BRANCH' existiert nicht im Repository $REPO_URL.\nVerfügbare Branches: $(git ls-remote --heads "$REPO_URL" | awk '{print $2}' | sed 's|refs/heads/||' | tr '\n' ' ')" +fi +ok "Branch '$GIT_BRANCH' gefunden" + if [[ -d "$INSTALL_DIR/.git" ]]; then if [[ "$REINSTALL" == true ]]; then info "Aktualisiere bestehendes Repository..."