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

[changelog] Skip merge commits in changelog #858

Closed
gastaldi opened this issue Jul 6, 2022 · 4 comments · Fixed by #867
Closed

[changelog] Skip merge commits in changelog #858

gastaldi opened this issue Jul 6, 2022 · 4 comments · Fixed by #867
Labels
enhancement New feature or request
Milestone

Comments

@gastaldi
Copy link
Contributor

gastaldi commented Jul 6, 2022

Is your feature request related to a problem? Please describe.
It's annoying that merge commits are included in the output of mvn jreleaser:changelog

Describe the solution you'd like
Never include merge commits in the changelog

Describe alternatives you've considered
Filter out Revcommits in org.jreleaser.sdk.git.ChangelogGenerator that are merge commits

Additional context

Original output:

## Changelog

3b557ee Add JReleaser to pluginManagement
f160387 [maven-release-plugin] prepare for next development iteration
cbc4fbd [maven-release-plugin] prepare release 10
51fd39a Merge pull request #55 from quarkiverse/release-10
db55eb8 Release v10
64f129d Update release.yml

Desired output:

## Changelog

3b557ee Add JReleaser to pluginManagement
f160387 [maven-release-plugin] prepare for next development iteration
cbc4fbd [maven-release-plugin] prepare release 10
db55eb8 Release v10
64f129d Update release.yml
@gastaldi gastaldi added the enhancement New feature or request label Jul 6, 2022
@aalmiray
Copy link
Member

aalmiray commented Jul 6, 2022

You can achieve this already by:

  • applying a label that matches merge commits by title
  • map the label to a category
  • hide the given category

JReleaser itself does it for its own changelog https://github.com/jreleaser/jreleaser/blob/main/jreleaser.yml

gastaldi added a commit to gastaldi/jreleaser that referenced this issue Jul 6, 2022
@gastaldi
Copy link
Contributor Author

gastaldi commented Jul 6, 2022

@aalmiray thanks for the response! I am failing to find a use case where merge commits are necessary for the change log, so it would be nice if we had a configuration option that would automatically hide that away or simply assume that merge commits are bad and should never be used.

For the second case, I have put a small fix here: dde2e22

The fix works, but I've been struggling a bit to create a test that simulates merge commits in the existing ChangelogGeneratorUnitTest, but I am not sure if it's worth creating it given the fix may not be what you desire.

WDYT?

@aalmiray
Copy link
Member

aalmiray commented Jul 6, 2022

@aalmiray thanks for the response! I am failing to find a use case where merge commits are necessary for the change log, so it would be nice if we had a configuration option that would automatically hide that away or simply assume that merge commits are bad and should never be used.

I understand your concern and I agree that most times merge commits could be omitted from the changelog. Then again I'd ask, why are there merge commits in the first case given that one could use rebase or squash to merge PRs?

The fact that a merge commit exists may be to keep track of the original info in such way that seeing a merge commit in the log makes sense. However, skipping the merge commit in the changelog also makes sense. This is why JReleaser offers the option to skip them but you must explicitly configure it so.

I think keeping this behavior explicit is best, for now. This decision may be revised in the future as more feedback is gathered on changelog formatting and usage. This being said, if the default behavior would be to skip such commits there must be a way to disable it just in case someone requires merge commits in the changelog. Your fix would technically work but it's not configurable. Moreover, does the fix apply solely to merge commits? Or are there any other types of commits for which the condition you put in place would also trigger?

@gastaldi
Copy link
Contributor Author

gastaldi commented Jul 6, 2022

@aalmiray thanks for the response! I am failing to find a use case where merge commits are necessary for the change log, so it would be nice if we had a configuration option that would automatically hide that away or simply assume that merge commits are bad and should never be used.

I understand your concern and I agree that most times merge commits could be omitted from the changelog. Then again I'd ask, why are there merge commits in the first case given that one could use rebase or squash to merge PRs?

The fact that a merge commit exists may be to keep track of the original info in such way that seeing a merge commit in the log makes sense. However, skipping the merge commit in the changelog also makes sense. This is why JReleaser offers the option to skip them but you must explicitly configure it so.

Yes, some open source projects disable rebase and squash commits and allow merge commits only for this reason mainly.

I think keeping this behavior explicit is best, for now. This decision may be revised in the future as more feedback is gathered on changelog formatting and usage. This being said, if the default behavior would be to skip such commits there must be a way to disable it just in case someone requires merge commits in the changelog.

Although I understand your point, I find it very unlikely that someone would want that, since a merge commit represents nothing but a synchronization point between two branches.

Your fix would technically work but it's not configurable. Moreover, does the fix apply solely to merge commits? Or are there any other types of commits for which the condition you put in place would also trigger?

That's a good question. AFAIK commits with more than 1 parent are considered merge commits but I'm not 100% sure if that matches other commit types.

gastaldi added a commit to gastaldi/jreleaser that referenced this issue Jul 6, 2022
@aalmiray aalmiray changed the title Skip merge commits in changelog [changelog] Skip merge commits in changelog Jul 7, 2022
margarita-nedzelska-sonarsource pushed a commit to margarita-nedzelska-sonarsource/jreleaser that referenced this issue Jul 18, 2022
margarita-nedzelska-sonarsource added a commit to margarita-nedzelska-sonarsource/jreleaser.github.io that referenced this issue Jul 18, 2022
aalmiray pushed a commit to jreleaser/jreleaser.github.io that referenced this issue Jul 19, 2022
@aalmiray aalmiray added this to the v1.2.0 milestone Jul 19, 2022
aalmiray added a commit to jreleaser/jreleaser.github.io that referenced this issue Jul 19, 2022
aalmiray pushed a commit to jreleaser/jreleaser.github.io that referenced this issue Aug 3, 2022
aalmiray added a commit to jreleaser/jreleaser.github.io that referenced this issue Aug 3, 2022
aalmiray pushed a commit to jreleaser/jreleaser.github.io that referenced this issue Aug 9, 2022
aalmiray added a commit to jreleaser/jreleaser.github.io that referenced this issue Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants