feat(script): add auto-heal for corrupt git repo

This commit is contained in:
João Pedro Toledo Goncalves 2026-01-27 09:11:30 -03:00
parent 9c4aee8c86
commit 35138518b2
1 changed files with 9 additions and 2 deletions

View File

@ -56,7 +56,14 @@ else
echo "[Pre-Flight] Repository exists. Pulling latest..." echo "[Pre-Flight] Repository exists. Pulling latest..."
cd "$REPO_DIR" cd "$REPO_DIR"
git config --global --add safe.directory "$REPO_DIR" git config --global --add safe.directory "$REPO_DIR"
git pull
# 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 fi
# SYMLINK SETUP # SYMLINK SETUP