upgrade: force-update the debian12-final tag fetch

The Debian 12 guard fetched the cutoff tag with a non-forcing refspec, so a
box that had already fetched an earlier `debian12-final` kept its stale local
tag ("would clobber existing tag" is rejected). When the tag later moved
(e.g. a version-bumped final release), the guard pinned to the OLD target
instead of the new one. Force the fetch (+ / --force) so a moved tag wins.
Safe: the commit's signature is still verified before checkout.

Caught on real Debian 12 hardware (10.0.0.8) after moving the tag for a patch
bump; added a sandbox scenario covering the moved-tag/stale-local-tag case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-18 17:02:10 -06:00
parent 7cd79bea4a
commit ee45b5e19d
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680

View file

@ -58,11 +58,14 @@ debian12_guard() {
return 0
fi
# Debian 12 (or older): make sure the cutoff tag is present locally.
# Debian 12 (or older): make sure the cutoff tag is present AND current.
# `debian12-final` is off the release line, so a plain fetch of the branch
# would not follow it.
git -C /opt/wrolpi fetch origin "refs/tags/${GUARD_TAG}:refs/tags/${GUARD_TAG}" 2>/dev/null \
|| git -C /opt/wrolpi fetch origin --tags 2>/dev/null || :
# would not follow it. Force (+ / --force) so a moved tag (e.g. a bumped
# final release) overwrites a stale local tag instead of being rejected as
# "would clobber existing tag" — otherwise the guard pins to the old target.
# Safe to force: the commit's signature is verified before checkout below.
git -C /opt/wrolpi fetch origin "+refs/tags/${GUARD_TAG}:refs/tags/${GUARD_TAG}" 2>/dev/null \
|| git -C /opt/wrolpi fetch --force --tags origin 2>/dev/null || :
# --verify --quiet: fail cleanly (empty, non-zero) instead of echoing the
# unresolved arg when the tag is absent.