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

Ignore reverted commits when generating changelogs #158

Open
bklp opened this issue Jul 20, 2023 · 2 comments
Open

Ignore reverted commits when generating changelogs #158

bklp opened this issue Jul 20, 2023 · 2 comments

Comments

@bklp
Copy link

bklp commented Jul 20, 2023

In case when there is commit + revert commit (with ref to the original commit) within a single version/tag, it would make sense to exclude both of them from commits passed for changelog rendering as they should basically cancel each other anyway. It would be nice to have it at least as an optional feature that can be enabled using configuration.

GitLab's changelog generator seems to have similar feature already, see:

@tomasbjerre
Copy link
Owner

See this test case:

public void testThatRevertedCommitsAreRemoved() throws Exception {

Where git history is:

* 4c6e078 - doing change 2
* 05866f7 - Revert "doing change 1"
* 114a917 - doing change 1
* 5973dd5 - Updating changelog with 1.147.2 [GRADLE SCRIPT]
* aa1fd33 - (tag: 1.147.2) New version: 1.147.2 [GRADLE SCRIPT]

This template:
https://github.com/tomasbjerre/git-changelog-lib/blob/d42e8fa63405b1d152e47d39dd48643bde82b1f8/src/test/resources/templatetest/testThatRevertedCommitsAreRemoved.mustache

Gives this result:

Is this what you want?

@bklp
Copy link
Author

bklp commented Jul 20, 2023

Yes, that is what I meant. I'd just note following:

  1. It should also work for case when multiple commits are reverted using single revert commit.
  2. What happens when there is revert commit of other revert commit(s) is something to consider too.

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

2 participants