fixup(release): promote.sh --allow-empty so identical-tree stable promotion still tags

Stable re-tags the same source commit as the last beta, so the extracted tree
is byte-identical and `git commit` would abort on "nothing to commit" under
set -euo pipefail, leaving the stable tag uncreated. Use --allow-empty and add
a promote.test.sh case that promotes a second identical-tree tag into the same
pub repo to guard the regression.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/v1-foundation
boban 2026-06-22 20:59:24 +02:00
parent 0dd7564ab0
commit 79bd08b0d8
2 changed files with 11 additions and 1 deletions

View File

@ -22,5 +22,7 @@ git -C "$src" archive --format=tar "$tag" | tar -x -C "$pub"
rm -rf "${pub:?}/.github"
git -C "$pub" add -A
git -C "$pub" commit -q -m "$msg"
# --allow-empty: stable promotion re-tags the same source commit as the last beta, so the
# extracted tree is byte-identical and there is nothing to stage — still produce a release commit.
git -C "$pub" commit -q --allow-empty -m "$msg"
git -C "$pub" tag "$tag"

8
scripts/promote.test.sh Normal file → Executable file
View File

@ -25,4 +25,12 @@ test ! -d "$work/pub/.github" || { echo "FAIL: .github leaked to public"; e
test -d "$work/pub/.git" || { echo "FAIL: public .git clobbered"; exit 1; }
git -C "$work/pub" rev-parse v1.0.0 >/dev/null 2>&1 || { echo "FAIL: tag missing"; exit 1; }
git -C "$work/pub" log -1 --pretty=%s | grep -qx 'Release v1.0.0' || { echo "FAIL: commit message"; exit 1; }
# Beta -> stable: stable re-tags the SAME source commit, so the extracted tree is byte-identical
# to the last promotion. Promote a second tag (same tree) into the SAME pub repo and assert it
# still creates the tag — guards against `git commit` aborting on "nothing to commit".
git -C "$work/src" tag v1.0.1 v1.0.0
bash "$here/promote.sh" "$work/src" v1.0.1 "$work/pub" "Release v1.0.1"
git -C "$work/pub" rev-parse v1.0.1 >/dev/null 2>&1 || { echo "FAIL: identical-tree tag missing"; exit 1; }
git -C "$work/pub" log -1 --pretty=%s | grep -qx 'Release v1.0.1' || { echo "FAIL: identical-tree commit message"; exit 1; }
echo "PASS"