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 <noreply@anthropic.com>
This commit is contained in:
@@ -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..."
|
||||
|
||||
Reference in New Issue
Block a user