Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include prerelease suffix in git #3841

Merged
merged 4 commits into from
Mar 20, 2023
Merged

Conversation

vandot
Copy link
Contributor

@vandot vandot commented Mar 6, 2023

This commit will fix bad version tag sort if there is a prerelease on the same commit as a release tag. Current output is shown below

❯ git tag --points-at HEAD --sort=-version:refname --format='%(creatordate)%09%(refname)'
Thu Mar 2 21:38:51 2023 +0300   refs/tags/v1.13.0-rc3
Thu Mar 2 21:38:51 2023 +0300   refs/tags/v1.13.0

Test is changed to match current default value so it will fail without this fix.

Default value - is set to the one that is described inside docs, but people are still allowed to change it.

Output with fix applied

❯ git -c versionsort.suffix=- tag --points-at HEAD --sort -version:refname --format='%(creatordate)%09%(refname)'
Thu Mar 2 21:38:51 2023 +0300   refs/tags/v1.13.0
Thu Mar 2 21:38:51 2023 +0300   refs/tags/v1.13.0-rc3

More info about versionsort.suffix can be found here

Docs as well both schemas are updated as well.

I am not sure if users should be allowed to change this option at all.

@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 6, 2023
@codecov
Copy link

codecov bot commented Mar 6, 2023

Codecov Report

Merging #3841 (88e39e9) into main (41bb6dc) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3841      +/-   ##
==========================================
+ Coverage   83.34%   83.36%   +0.01%     
==========================================
  Files         123      123              
  Lines       10580    10589       +9     
==========================================
+ Hits         8818     8827       +9     
  Misses       1431     1431              
  Partials      331      331              
Impacted Files Coverage Δ
pkg/config/config.go 95.21% <ø> (ø)
internal/pipe/git/git.go 85.94% <100.00%> (+0.52%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@caarlos0 caarlos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for the PR!

I made a couple of comments, let me know what you think!

internal/pipe/git/git_test.go Show resolved Hide resolved
www/docs/customization/git.md Show resolved Hide resolved
internal/pipe/git/git.go Outdated Show resolved Hide resolved
@caarlos0 caarlos0 added the enhancement New feature or request label Mar 6, 2023
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 7, 2023
@vandot
Copy link
Contributor Author

vandot commented Mar 7, 2023

@caarlos0 thank you for your comments. I don't like my approach with args, that's why I set it to have default value in the first place :)

internal/pipe/git/git.go Outdated Show resolved Hide resolved
@caarlos0 caarlos0 changed the title fix: include prerelase suffix in git feat: include prerelase suffix in git Mar 7, 2023
@caarlos0
Copy link
Member

caarlos0 commented Mar 7, 2023

awesome, thanks for the work!

this will be in goreleaser 1.17, so, by the end of march, if everything goes well.
Will leave this open for a couple of weeks in case we need to do patch releases of 1.16.
If conflicts happen, don't worry about it, I'll fix them.

Thanks, again!

@caarlos0 caarlos0 added this to the v1.17.0 milestone Mar 7, 2023
@caarlos0 caarlos0 changed the title feat: include prerelase suffix in git feat: include prerelease suffix in git Mar 7, 2023
@caarlos0 caarlos0 merged commit 8877fe1 into goreleaser:main Mar 20, 2023
caarlos0 added a commit that referenced this pull request Mar 20, 2023
refs #3841

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants