commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

The config "changelog_merge_prerelease" is ignored when the changelog is modified through cz bump (--changelog)

Open zimmermannJakob opened this issue 1 month ago • 4 comments

Description

The config "changelog_merge_prerelease" is ignored when the changelog is modified through cz bump (--changelog).

I think I located the issue at https://github.com/commitizen-tools/commitizen/blob/9f3ec868c0429155a46b4819b625d47a8522a3d5/commitizen/commands/bump.py#L308-L314, where the args do not contain changelog command specific arguments. I can provide a PR over the weekend.

Steps to reproduce

  1. Create a test git repo git init
  2. Create a .cz.toml config with the following content:
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "$version"
version_scheme = "semver2"
version = "0.1.0"
update_changelog_on_bump = true
changelog_merge_prerelease = true
  1. git add . && cz commit
  2. Create a prerelease with cz bump --prerelease rc
  3. Create the final release with cz bump or cz bump --changelog

Current behavior

In step 4. the prerelease entry is created as expected, but it is not merged in step 5: Resulting changelog:

## 0.1.1 (2025-12-05)

## 0.1.1-rc.0 (2025-12-05)

Desired behavior

The release candidate is merged with the actual release:

## 0.1.1 (2025-12-05)

### Fix
...

The desired behavior may be observed by performing cz changelog.

Screenshots

No response

Environment

Commitizen Version: 4.10.0 Python Version: 3.14.1 (main, Dec 2 2025, 12:51:37) [Clang 17.0.0 (clang-1700.4.4.1)] Operating System: Darwin

zimmermannJakob avatar Dec 05 '25 17:12 zimmermannJakob

I can provide a PR over the weekend.

Sounds good! Thanks for locating the issue!

bearomorphism avatar Dec 06 '25 12:12 bearomorphism

We are also planning to redesign how commitizen pass options iirc

The code you located is really error prone when we are adding new options

bearomorphism avatar Dec 06 '25 13:12 bearomorphism

We are also planning to redesign how commitizen pass options iirc

Sounds good! Unfortunately, my initial diagnosis was incorrect, as the argument is correctly passed. I opened a Draft PR, where the issue is fixed to the best of my ability.

Before manual testing and polishing the PR, I ask that someone with a deeper understanding of the codebase takes a look and provides feedback. I will be happy to incorporate it.

zimmermannJakob avatar Dec 07 '25 15:12 zimmermannJakob

Haven't looked into the issue. I would suggest you to run a debugger if you're not sure what goes wrong

bearomorphism avatar Dec 07 '25 16:12 bearomorphism