From a6e611736b9a7a5037dd815356932945dac14114 Mon Sep 17 00:00:00 2001 From: cynarAI <155274210+cynarAI@users.noreply.github.com> Date: Mon, 5 Oct 2026 14:46:20 +0200 Subject: [PATCH] fix(evo-deploy): prefer the fetched remote branch when resolving the deploy ref (#160) A manual deploy.sh run without a SHA resolved the local 'main' first, which lags behind origin/main in the deploy checkout, and redeployed the old commit. Resolve / first and fall back to the ref itself for SHAs and tags. Claude-Session: https://claude.ai/code/session_01YMUEBB4pr4TtGSMhEAKonM Co-authored-by: Claude --- ops/evo-deploy/deploy.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ops/evo-deploy/deploy.sh b/ops/evo-deploy/deploy.sh index 054261c..3abcf17 100755 --- a/ops/evo-deploy/deploy.sh +++ b/ops/evo-deploy/deploy.sh @@ -286,10 +286,13 @@ git_fetch_and_checkout() { log "previous HEAD: $previous_sha" log "fetching $EVO_GIT_REMOTE…" run git -C "$EVO_DEPLOY_DIR" fetch "$EVO_GIT_REMOTE" --prune >&2 - if git -C "$EVO_DEPLOY_DIR" rev-parse --verify "${EVO_DEPLOY_REF}^{commit}" >/dev/null 2>&1; then - target_sha="$(git -C "$EVO_DEPLOY_DIR" rev-parse "${EVO_DEPLOY_REF}^{commit}")" - elif git -C "$EVO_DEPLOY_DIR" rev-parse --verify "${EVO_GIT_REMOTE}/${EVO_DEPLOY_REF}^{commit}" >/dev/null 2>&1; then + # Prefer the freshly fetched remote branch: the local `main` in the deploy + # checkout never moves (we reset HEAD, not the branch), so resolving it first + # would redeploy a stale commit. + if git -C "$EVO_DEPLOY_DIR" rev-parse --verify "${EVO_GIT_REMOTE}/${EVO_DEPLOY_REF}^{commit}" >/dev/null 2>&1; then target_sha="$(git -C "$EVO_DEPLOY_DIR" rev-parse "${EVO_GIT_REMOTE}/${EVO_DEPLOY_REF}^{commit}")" + elif git -C "$EVO_DEPLOY_DIR" rev-parse --verify "${EVO_DEPLOY_REF}^{commit}" >/dev/null 2>&1; then + target_sha="$(git -C "$EVO_DEPLOY_DIR" rev-parse "${EVO_DEPLOY_REF}^{commit}")" else die "cannot resolve ref: $EVO_DEPLOY_REF" fi