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

Release notes incorrect when using TagStrategy setPrefixNameWithV(false) #221

Open
sdavids13 opened this issue Mar 31, 2022 · 2 comments
Open

Comments

@sdavids13
Copy link

When using TagStrategy setPrefixNameWithV(false) the full contents of the Git history is contained in every release notes section. This is because the TagStrategy generateMessage closure grabs the "previousVersion" and always prefixes "v" in front of the commit that is looked up in the git repository (for which it never finds the commit since it's not there). The code of interest can be found here:

if (version.previousVersion) {
String previousVersion = "v${version.previousVersion}^{commit}"
List excludes = []
if (tagExists(grgit, previousVersion)) {
excludes << previousVersion
}
grgit.log([includes: ['HEAD'], excludes: excludes]).inject(builder) { bldr, Commit commit ->
bldr << "- ${commit.id}: ${commit.shortMessage}\n"
}
}

@sdavids13
Copy link
Author

Quick follow-up, looks like the OpinionReleasePlugin accounts for the distinction here:
https://github.com/nebula-plugins/nebula-release-plugin/blob/main/src/main/groovy/nebula/plugin/release/git/opinion/OpinionReleasePlugin.groovy#L71

With the test case being found here:
https://github.com/nebula-plugins/nebula-release-plugin/blob/main/src/test/groovy/nebula/plugin/release/git/opinion/OpinionReleasePluginSpec.groovy#L62-L82

So, it appears the ReleasePlugin line 114 should simply be changed to:
String previousVersion = "${project.release.tagStrategy.toTagString(version.previousVersion)}^{commit}"

sdavids13 added a commit to sdavids13/nebula-release-plugin that referenced this issue Apr 1, 2022
Release notes when prefixNameWithV==false is corrected by finding the previous tag
@sdavids13
Copy link
Author

PR that fixes this issue: #222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant