Skip to content

Commit 9754d68

Browse files
authored
Merge pull request #536 from commitizen-tools/fix/duplicate-changelog-entries
2 parents 234765d + 0307360 commit 9754d68

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

commitizen/cz/conventional_commits/conventional_commits.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class ConventionalCommitsCz(BaseCommitizen):
3838
"refactor": "Refactor",
3939
"perf": "Perf",
4040
}
41+
changelog_pattern = defaults.bump_pattern
4142

4243
def questions(self) -> Questions:
4344
questions: Questions = [

tests/commands/test_changelog_command.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,3 +872,21 @@ def test_changelog_from_rev_latest_version_dry_run(
872872
out, _ = capsys.readouterr()
873873

874874
file_regression.check(out, extension=".md")
875+
876+
877+
@pytest.mark.usefixtures("tmp_commitizen_project")
878+
def test_invalid_subject_is_skipped(mocker, capsys):
879+
"""Fix #510"""
880+
non_conformant_commit_title = (
881+
"Merge pull request #487 from manang/master\n\n"
882+
"feat: skip merge messages that start with Pull request\n"
883+
)
884+
create_file_and_commit(non_conformant_commit_title)
885+
create_file_and_commit("feat: a new world")
886+
testargs = ["cz", "changelog", "--dry-run"]
887+
mocker.patch.object(sys, "argv", testargs)
888+
with pytest.raises(DryRunExit):
889+
cli.main()
890+
out, _ = capsys.readouterr()
891+
892+
assert out == ("## Unreleased\n\n### Feat\n\n- a new world\n\n")

0 commit comments

Comments
 (0)