From 85fd37737ac1337c2675e35dab49c39063ddc267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 14 Sep 2026 10:59:39 +0000 Subject: [PATCH] :bug: Refresh origin/HEAD before pubv preflight pubv resolves the default branch from the local refs/remotes/origin/HEAD, which git fetch never updates, so a clone or default-branch change left it stale and pubv warned that main was not the default. Refresh it from the remote before pubv runs, and assert releases are cut from main explicitly. --- scripts/release.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/release.sh b/scripts/release.sh index f743e7e..9d45cb0 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -23,12 +23,35 @@ set -eu # exactly what this ~30-line version replaces. CHANGELOG="CHANGELOG.md" +BASE="main" if ! command -v code >/dev/null 2>&1; then echo "Error: 'code' (VS Code CLI) not found; install it or remove the editor step." >&2 exit 1 fi +# Releases are cut from `main` (see CONTRIBUTING § Publishing workflow). Make +# that explicit rather than relying on pubv's default-branch check, so the +# error names `main` even when the remote's default is configured differently. +CURRENT=$(git symbolic-ref --quiet --short HEAD || true) +if [ "${CURRENT}" != "${BASE}" ]; then + echo "Error: releases are cut from '${BASE}', but HEAD is '${CURRENT:-detached}'." >&2 + exit 1 +fi + +# pubv decides the "default branch" by reading the *local* +# `refs/remotes/origin/HEAD`, not by asking the remote, and `git fetch` never +# updates that ref. After a default-branch change — or a clone from when the +# default was different — it goes stale and pubv warns/fails because the +# current branch (main) does not match it, even though main *is* the remote +# default. Refresh it from the remote first, so pubv's branch preflight +# compares against reality. (Without a network this fails, but so would the +# push pubv is about to do, so it is a real error rather than one to swallow.) +if ! git remote set-head origin --auto >/dev/null 2>&1; then + echo "Error: could not refresh origin/HEAD; check connectivity to origin." >&2 + exit 1 +fi + echo "Running pubv..." pubv --no-tag --no-push --tag-prefix=none