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

fix: Duplicate commits for unreleased version with merged brances #76

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

chme
Copy link
Contributor

@chme chme commented Mar 18, 2024

Unfortunately the new logic to follow the commit graph to assign commits to versions has one bug.

If there are merge commits into the unreleased version, all following commits will be counted twice. And this applies for each merge commit (and with lots of merges, this results also in quite a performance issue - I first thought it is an endless loop ...).

The problematic part is "marking" a commit to be already assigned to a version, to not assign it again (and stop following the commit graph), only works if the version string is not empty. This is not the case for the unreleased version.

For example, given the following commit graph:

gitGraph
   commit id: "A"
   branch feat/1
   checkout feat/1
   commit id: "B"
   checkout main
   merge feat/1 id: "C"
   branch feat/2
   checkout feat/2
   commit id: "D"
   checkout main
   merge feat/2 id: "E"
Loading

This results in an unreleased version with:

  • E
  • C
  • A
  • B
  • A
  • D
  • C
  • A
  • B
  • A

This solution implemented in this PR is to assign the commits a "HEAD" version if they belong to the unreleased version.
This avoids that the commits are added more than once.

Copy link
Owner

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

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

Clear explanation, simple fix, test illustrating the issue: lgtm! Thanks for quickly noticing and fixing this.

@pawamoy pawamoy merged commit b61199f into pawamoy:main Mar 18, 2024
16 checks passed
@chme chme deleted the fix/unreleased-merges branch March 19, 2024 18:19
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.

2 participants