@@ -1491,6 +1491,31 @@ def test_changelog_template_extras_precedance(
1491
1491
assert changelog .read_text () == "from-command - from-config - from-plugin"
1492
1492
1493
1493
1494
+ @pytest .mark .usefixtures ("tmp_commitizen_project" )
1495
+ @pytest .mark .freeze_time ("2021年06月11日" )
1496
+ def test_changelog_only_tag_matching_tag_format_included (
1497
+ mocker : MockFixture ,
1498
+ changelog_path : Path ,
1499
+ config_path : Path ,
1500
+ ):
1501
+ with open (config_path , "a" , encoding = "utf-8" ) as f :
1502
+ f .write ('\n tag_format = "${version}custom"\n ' )
1503
+ create_file_and_commit ("feat: new file" )
1504
+ git .tag ("v0.2.0" )
1505
+ create_file_and_commit ("feat: another new file" )
1506
+ git .tag ("0.2.0" )
1507
+ git .tag ("random0.2.0" )
1508
+ testargs = ["cz" , "bump" , "--changelog" , "--yes" ]
1509
+ mocker .patch .object (sys , "argv" , testargs )
1510
+ cli .main ()
1511
+ wait_for_tag ()
1512
+ with open (changelog_path ) as f :
1513
+ out = f .read ()
1514
+ assert out .startswith ("## 0.2.0custom (2021年06月11日)" )
1515
+ assert "## v0.2.0 (2021年06月11日)" not in out
1516
+ assert "## 0.2.0 (2021年06月11日)" not in out
1517
+
1518
+
1494
1519
def test_changelog_template_extra_quotes (
1495
1520
mocker : MockFixture ,
1496
1521
tmp_commitizen_project : Path ,
0 commit comments