You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(changelog): add changelog_subject_only to skip body parsing
Closes#1267.
`generate_tree_from_commits()` historically parses the commit subject and
each `\n\n`-separated body block against `commit_parser`, so a commit
whose subject is `feat: ...` and whose body contains another
`refactor: ...` line produces two changelog entries instead of one.
Maintainer ack on #1267 confirms this is undesirable, but changing the
default is a behavioural break.
This change introduces `changelog_subject_only` (default `false`) on
`Settings`. When set to `true`, the body iteration in
`generate_tree_from_commits()` is skipped, leaving only the subject
line to be matched. The setting is plumbed through
`commands/changelog.py` so both `cz changelog` and `cz bump --changelog`
honour it.
A regression test exercises both modes against a commit whose body
contains a parser-matching block.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/commands/changelog.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,6 +147,26 @@ This flag can be set in the configuration file with the key `changelog_merge_pre
147
147
changelog_merge_prerelease = true
148
148
```
149
149
150
+
### `changelog_subject_only`
151
+
152
+
By default, Commitizen parses both the subject line and any `\n\n`-separated body blocks of each commit against `commit_parser`, so a commit such as
153
+
154
+
```
155
+
feat: new feature
156
+
157
+
refactor: incidental cleanup
158
+
```
159
+
160
+
produces *two* changelog entries (one under `feat`, one under `refactor`). Set this configuration to `true` to limit changelog parsing to the subject line only.
161
+
162
+
```toml
163
+
[tool.commitizen]
164
+
# ...
165
+
changelog_subject_only = true
166
+
```
167
+
168
+
The default (`false`) preserves the historical behaviour.
169
+
150
170
### `--template`
151
171
152
172
Provide your own changelog Jinja template by using the `template` settings or the `--template` parameter.
0 commit comments