Skip to content

[Bug] merge-message-formats gets overwritten #2371

@chrisism

Description

@chrisism

Describe the bug
When you set your own custom merge-message-formats it will get overwritten when applying gitversion.
Running the gitversion /showConfig will just show a emtpy dictionary again :
commit-date-format: yyyy-MM-dd merge-message-formats: {} update-build-number: true

Expected Behavior

When I insert a custom merge-message-format I expect it to end up in the combined config and applied during gitversion action.

Actual Behavior

merge-message-formats stays { }

Possible Fix

The default Config() that is used as override in ConfigProvider has by default an empty dictionary for mergemessageformats, which will then override the custom dictionary because it only checks for NULL value. Merge dictionaries instead of override.

Steps to Reproduce

Alter gitversion.yml with:
merge-message-formats: tfs:'^Merged (?:PR (?<PullRequestNumber>\d+)): (M|m)erge (?<SourceBranch>.+) (in)?to (?<TargetBranch>.+)'
execute: gitversion /showConfig
Result:
ignore: sha: [] commit-date-format: yyyy-MM-dd merge-message-formats: {} update-build-number: true

Context

Now I can only use tags for incrementing. All my build pipelines in azure devops are now getting incorrect versions.

Your Environment

Azure devops, using latest gittools task as.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions