Skip to content

fix(release): keep git tag stdout out of create_tags return value#728

Merged
Chemaclass merged 1 commit into
mainfrom
fix/release-create-tags-stdout
Jun 16, 2026
Merged

fix(release): keep git tag stdout out of create_tags return value#728
Chemaclass merged 1 commit into
mainfrom
fix/release-create-tags-stdout

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

Summary

Follow-up to #727. During the 0.40.0 release, release::create_tags returned a polluted value: when the floating major tag (v0) already exists, git tag -f writes Updated tag 'v0' (was <sha>) to stdout, and major_tag=$(release::create_tags ...) captured it. The push step then got git push origin "Updated tag 'v0' (was ...)\nv0" --force and failed with fatal: invalid refspec.

The 0.40.0 release was completed manually (tag/v0/GitHub release/latest all published correctly); this PR fixes the script so the next release runs clean end-to-end.

Changes

  • Redirect both git tag commands' stdout to /dev/null in release::create_tags so only the major tag name reaches stdout. Errors still surface on stderr (and set -e still aborts on failure).
  • Add test_create_tags_returns_clean_name_when_major_tag_already_exists, which pre-creates v0 to exercise the git tag -f update path. The original tests only covered first-time creation (which prints nothing), so they missed this. Verified the new test fails on the pre-fix code and passes with the fix.

Test plan

  • ./bashunit tests/unit/release_*.sh — all green
  • make sa && make lint && shfmt — clean

When the major tag already exists, `git tag -f` prints "Updated tag 'v0'
(was ...)" to stdout, which `major_tag=$(release::create_tags ...)` captured,
producing an invalid push refspec during a real release. Redirect the tag
commands' stdout to /dev/null so only the major tag name is returned. Add a
regression test that pre-creates the major tag to exercise the update path
the original test missed.
@Chemaclass Chemaclass added the bug Something isn't working label Jun 16, 2026
@Chemaclass Chemaclass self-assigned this Jun 16, 2026
@Chemaclass Chemaclass merged commit 533ab4a into main Jun 16, 2026
31 checks passed
@Chemaclass Chemaclass deleted the fix/release-create-tags-stdout branch June 16, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant