fix(installer): reset managed clone when ff-only pull fails

Bootstrap and desktop updates run install.ps1/install.sh, which aborted
with exit 128 when the managed checkout had diverged from origin/main.
Mirror the hermes update recovery path: reset to origin/$BRANCH instead
of failing the repository stage.
This commit is contained in:
xxxigm 2026-06-30 20:11:01 +07:00
parent 824f2279da
commit a40f22798e
2 changed files with 17 additions and 2 deletions

View file

@ -1222,7 +1222,14 @@ clone_repo() {
git remote set-branches origin "$BRANCH" 2>/dev/null || true
git fetch origin "$BRANCH"
git checkout "$BRANCH"
git pull --ff-only origin "$BRANCH"
# Managed installs should follow origin/$BRANCH exactly. If the
# checkout has diverged (or has local-only commits), ff-only pull
# cannot succeed — mirror ``hermes update`` and reset to the
# fetched remote so bootstrap/install can recover.
if ! git pull --ff-only origin "$BRANCH"; then
log_warn "Fast-forward not possible; resetting managed install to origin/$BRANCH..."
git reset --hard "origin/$BRANCH"
fi
if [ -n "$autostash_ref" ]; then
local restore_now="yes"