fix(release): keep git tag stdout out of create_tags return value#728
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #727. During the 0.40.0 release,
release::create_tagsreturned a polluted value: when the floating major tag (v0) already exists,git tag -fwritesUpdated tag 'v0' (was <sha>)to stdout, andmajor_tag=$(release::create_tags ...)captured it. The push step then gotgit push origin "Updated tag 'v0' (was ...)\nv0" --forceand failed withfatal: 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
git tagcommands' stdout to/dev/nullinrelease::create_tagsso only the major tag name reaches stdout. Errors still surface on stderr (andset -estill aborts on failure).test_create_tags_returns_clean_name_when_major_tag_already_exists, which pre-createsv0to exercise thegit tag -fupdate 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 greenmake sa && make lint && shfmt— clean