Skip to content

Conversation

DSpirit
Copy link
Contributor

@DSpirit DSpirit commented Mar 17, 2024

Extended the TryParse operation to include a regex check whether the commit message contains one of the specified CommitMessageFormats in order to support increment of merges from release into main branch when a squash merge has been applied.

Motivation and Context

Discussion

How Has This Been Tested?

  • Local tests with only one merge commit worked
  • Extended the MergeMessageBaseVersionStrategyTests.cs with a test using the false flag on IsMergeCommit

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Member

@asbjornu asbjornu left a comment

Choose a reason for hiding this comment

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

This was less code than I expected. If the tests pass, I give this a 👍🏼.

configuration.MergeMessageFormats
.Select(n => new MergeMessageFormat(n.Key, n.Value)));

if (mergeCommit.IsMergeCommit || mergeMessageFormats.Any(format => format.Pattern.IsMatch(mergeCommit.Message)))
Copy link
Member

Choose a reason for hiding this comment

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

Can we expose this as Commit.HasMergeMessage(…) instead?

Suggested change
if (mergeCommit.IsMergeCommit || mergeMessageFormats.Any(format => format.Pattern.IsMatch(mergeCommit.Message)))
if (mergeCommit.IsMergeCommit || mergeCommit.HasMergeMessage(mergeMessageFormats))

@DSpirit DSpirit closed this Mar 29, 2024
@DSpirit DSpirit deleted the feature/support-squash-commits branch March 29, 2024 19:30
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