From 35138518b22e3f1d98e387efaec763c8b9d9b032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Toledo?= Date: Tue, 27 Jan 2026 09:11:30 -0300 Subject: [PATCH] feat(script): add auto-heal for corrupt git repo --- scripts/pre-flight.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/pre-flight.sh b/scripts/pre-flight.sh index 002fcd8..8815d5b 100644 --- a/scripts/pre-flight.sh +++ b/scripts/pre-flight.sh @@ -56,8 +56,15 @@ else echo "[Pre-Flight] Repository exists. Pulling latest..." cd "$REPO_DIR" git config --global --add safe.directory "$REPO_DIR" - git pull -fi + + # Attempt pull, if fails (lock file or corruption), wipe and re-clone + if ! git pull; then + echo "[Pre-Flight] ERROR: Git pull failed (likely corrupt ref/lock). Re-cloning..." + cd / + rm -rf "$REPO_DIR" + mkdir -p "$REPO_DIR" + git clone "$GIT_URL" "$REPO_DIR" + fi # SYMLINK SETUP # We want Nginx to use the configs from the repo (dynamic) instead of the baked-in ones (static).