Skip to content

Conversation

@KennethTrecy
Copy link

Closes #11

This PR slightly modifies parseGitCommit() and related types to extract the commits that has been reverted. Then, filterCommits() removes the commits that revert others or has been reverted. However, the commit that does the reversion, and the commits that would be reverted should be in the current version only. See the following scenarios below.

For example, we have the following log:

abc123 (tag: v1.1.0) chore: fifth commit (reverts def456)
cba123 chore: fourth commit
def456 chore: third commit
fed456 (tag: v1.0.0) chore: second commit
abc789 chore: first commit

In this example, commit abc123 reverts the commit def456. Therefore, both of them would not be present in the resulting change log set. Only the fourth commit would show.

However, if a commit reverts a commit from previous version, it would not remove it.

abc123 (tag: v1.1.0) chore: fifth commit 
cba123 chore: fourth commit (reverts abc789)
def456 chore: third commit
fed456 (tag: v1.0.0) chore: second commit
abc789 chore: first commit

In this second example, third, fourth, and fifth commit would be shown in the change log set.

I added tests to ensure the implementation is working. Let me know if there is something I could improve in this PR. Thank you.

@pi0 pi0 changed the title Revert resolver feat: remove revert commits from changelog Feb 20, 2023
@codecov
Copy link

codecov bot commented Feb 20, 2023

Codecov Report

Merging #65 (805d93d) into main (1b5fa2d) will increase coverage by 14.20%.
The diff coverage is 97.01%.

❗ Current head 805d93d differs from pull request most recent head c3652ac. Consider uploading reports for the commit c3652ac to get more accurate results

@@             Coverage Diff             @@
##             main      #65       +/-   ##
===========================================
+ Coverage   68.63%   82.84%   +14.20%     
===========================================
  Files           9        5        -4     
  Lines         880      542      -338     
  Branches       81       78        -3     
===========================================
- Hits          604      449      -155     
+ Misses        276       93      -183     
Impacted Files Coverage Δ
src/git.ts 90.00% <97.01%> (+6.23%) ⬆️

... and 8 files with indirect coverage changes

@danielroe danielroe requested a review from pi0 March 6, 2024 14:59
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

Successfully merging this pull request may close these issues.

Resolve reverts

1 participant