From 3be276d23ea98473a030982dab102b8358a4c110 Mon Sep 17 00:00:00 2001 From: Christopher Cyclonit Klinge Date: Sat, 16 Mar 2024 15:12:18 +0100 Subject: [PATCH] refactor(config): update description and documentation for option `changelog.header` Updated description and documentation for option `changelog.header`. --- .../fixtures/new-fixture-template/cliff.toml | 15 +- .../test-bump-version-keep-zerover/cliff.toml | 15 +- .github/fixtures/test-bump-version/cliff.toml | 15 +- .../fixtures/test-bumped-version/cliff.toml | 15 +- .../fixtures/test-commit-footers/cliff.toml | 15 +- .../test-commit-preprocessors/cliff.toml | 15 +- .github/fixtures/test-custom-scope/cliff.toml | 17 +- .../test-custom-tag-pattern/cliff.toml | 15 +- .github/fixtures/test-date-order/cliff.toml | 15 +- .../fixtures/test-footer-template/cliff.toml | 15 +- .../test-github-integration/cliff.toml | 15 +- .github/fixtures/test-ignore-tags/cliff.toml | 15 +- .../cliff.toml | 19 +- .../cliff.toml | 19 +- .../cliff.toml | 19 +- .../cliff.toml | 19 +- .../cliff.toml | 19 +- .../cliff.toml | 19 +- .../cliff.toml | 19 +- .../test-keep-a-changelog-links/cliff.toml | 19 +- .../test-latest-with-one-tag/cliff.toml | 15 +- .../fixtures/test-limit-commits/cliff.toml | 15 +- .github/fixtures/test-no-exec/cliff.toml | 17 +- .../test-order-by-topology-arg/cliff.toml | 15 +- .../test-order-by-topology/cliff.toml | 15 +- .../test-regex-replace-parser/cliff.toml | 15 +- .../test-skip-breaking-changes/cliff.toml | 15 +- .github/fixtures/test-skip-commits/cliff.toml | 15 +- .../fixtures/test-split-commits/cliff.toml | 15 +- cliff.toml | 21 +-- config/cliff.toml | 21 +-- examples/cocogitto.toml | 21 +-- examples/detailed.toml | 19 +- examples/github-keepachangelog.toml | 19 +- examples/github.toml | 19 +- examples/keepachangelog.toml | 19 +- examples/minimal.toml | 5 +- examples/scoped.toml | 19 +- examples/scopesorted.toml | 19 +- examples/unconventional.toml | 19 +- git-cliff-core/src/changelog.rs | 50 ++--- git-cliff-core/src/commit.rs | 36 ++-- git-cliff-core/src/config/mod.rs | 9 + git-cliff-core/src/config/models_v1.rs | 88 +++++++++ .../src/{config.rs => config/models_v2.rs} | 174 ++++++------------ git-cliff-core/src/config/parsing.rs | 44 +++++ git-cliff-core/src/config/test.rs | 66 +++++++ git-cliff-core/src/embed.rs | 2 +- git-cliff-core/src/github.rs | 2 +- git-cliff-core/src/release.rs | 2 +- git-cliff-core/src/repo.rs | 2 +- git-cliff-core/src/template.rs | 2 +- git-cliff-core/tests/integration_test.rs | 23 +-- git-cliff/src/args.rs | 8 +- git-cliff/src/lib.rs | 28 ++- release.sh | 2 +- website/docs/configuration/changelog.md | 31 ++-- website/docs/configuration/commit.md | 5 - website/docs/integration/python.md | 6 +- website/docs/integration/rust.md | 6 +- website/docs/usage/args.md | 2 +- 61 files changed, 695 insertions(+), 565 deletions(-) create mode 100644 git-cliff-core/src/config/mod.rs create mode 100644 git-cliff-core/src/config/models_v1.rs rename git-cliff-core/src/{config.rs => config/models_v2.rs} (70%) create mode 100644 git-cliff-core/src/config/parsing.rs create mode 100644 git-cliff-core/src/config/test.rs diff --git a/.github/fixtures/new-fixture-template/cliff.toml b/.github/fixtures/new-fixture-template/cliff.toml index 82a6473b90..47b901979d 100644 --- a/.github/fixtures/new-fixture-template/cliff.toml +++ b/.github/fixtures/new-fixture-template/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-bump-version-keep-zerover/cliff.toml b/.github/fixtures/test-bump-version-keep-zerover/cliff.toml index 15414304ae..bbb34220dd 100644 --- a/.github/fixtures/test-bump-version-keep-zerover/cliff.toml +++ b/.github/fixtures/test-bump-version-keep-zerover/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [bump] features_always_bump_minor = false diff --git a/.github/fixtures/test-bump-version/cliff.toml b/.github/fixtures/test-bump-version/cliff.toml index ec2fc39132..24e42bb4ff 100644 --- a/.github/fixtures/test-bump-version/cliff.toml +++ b/.github/fixtures/test-bump-version/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] {% else %}\ @@ -19,9 +18,9 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-bumped-version/cliff.toml b/.github/fixtures/test-bumped-version/cliff.toml index ec2fc39132..24e42bb4ff 100644 --- a/.github/fixtures/test-bumped-version/cliff.toml +++ b/.github/fixtures/test-bumped-version/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] {% else %}\ @@ -19,9 +18,9 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-commit-footers/cliff.toml b/.github/fixtures/test-commit-footers/cliff.toml index e143f3b6e9..5ee7d8ebab 100644 --- a/.github/fixtures/test-commit-footers/cliff.toml +++ b/.github/fixtures/test-commit-footers/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -22,9 +21,9 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-commit-preprocessors/cliff.toml b/.github/fixtures/test-commit-preprocessors/cliff.toml index ce873aa8f4..d8c038c309 100644 --- a/.github/fixtures/test-commit-preprocessors/cliff.toml +++ b/.github/fixtures/test-commit-preprocessors/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of preprocessors to modify commit messages using regex prior to further processing. diff --git a/.github/fixtures/test-custom-scope/cliff.toml b/.github/fixtures/test-custom-scope/cliff.toml index cfd5238f91..f7d494478d 100644 --- a/.github/fixtures/test-custom-scope/cliff.toml +++ b/.github/fixtures/test-custom-scope/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -22,14 +21,12 @@ body = """ {% endfor %}\ {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true - -[release] +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-custom-tag-pattern/cliff.toml b/.github/fixtures/test-custom-tag-pattern/cliff.toml index 941dedaf70..0a25fc6c84 100644 --- a/.github/fixtures/test-custom-tag-pattern/cliff.toml +++ b/.github/fixtures/test-custom-tag-pattern/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="alpha-") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-date-order/cliff.toml b/.github/fixtures/test-date-order/cliff.toml index 5504810e90..de3df0399f 100644 --- a/.github/fixtures/test-date-order/cliff.toml +++ b/.github/fixtures/test-date-order/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,9 +18,9 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-footer-template/cliff.toml b/.github/fixtures/test-footer-template/cliff.toml index ebfa371d5a..d088363ecb 100644 --- a/.github/fixtures/test-footer-template/cliff.toml +++ b/.github/fixtures/test-footer-template/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] {% else %}\ @@ -19,8 +18,8 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ {% for release in releases %}\ {% if release.version %}\ {% if release.previous.version %}\ @@ -31,5 +30,5 @@ footer = """ {% endif %}\ {% endfor %}\ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-github-integration/cliff.toml b/.github/fixtures/test-github-integration/cliff.toml index bdee8e8703..65942c4eac 100644 --- a/.github/fixtures/test-github-integration/cliff.toml +++ b/.github/fixtures/test-github-integration/cliff.toml @@ -3,9 +3,8 @@ owner = "orhun" repo = "git-cliff-readme-example" [changelog] -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ ## What's Changed {%- if version %} in {{ version }}{%- endif -%} @@ -31,15 +30,13 @@ body = """ {% raw %}\n{% endraw %} {% endif %} """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -[release] - [commit] # Whether to parse commits according to the conventional commits specification. # Sets the commits' `group` (= `type`), `scope`, `message` (= `description`), `body`, `breaking`, `breaking_description` and `footers`. diff --git a/.github/fixtures/test-ignore-tags/cliff.toml b/.github/fixtures/test-ignore-tags/cliff.toml index 0f1e20a88f..8010109c23 100644 --- a/.github/fixtures/test-ignore-tags/cliff.toml +++ b/.github/fixtures/test-ignore-tags/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [release] # Regex to select git tags that do not represent proper releases. Takes precedence over `release.tags_pattern`. diff --git a/.github/fixtures/test-keep-a-changelog-links-current-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-current-arg/cliff.toml index dfe6b2fbbb..d602a2d133 100644 --- a/.github/fixtures/test-keep-a-changelog-links-current-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-current-arg/cliff.toml @@ -1,5 +1,5 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -7,9 +7,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ {% if previous %}\ {% if previous.version %}\ @@ -36,10 +35,10 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ @@ -77,8 +76,8 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest. diff --git a/.github/fixtures/test-keep-a-changelog-links-latest-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-latest-arg/cliff.toml index 782e658e48..346c1fa284 100644 --- a/.github/fixtures/test-keep-a-changelog-links-latest-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-latest-arg/cliff.toml @@ -1,5 +1,5 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -7,9 +7,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ {% if previous %}\ {% if previous.version %}\ @@ -36,12 +35,14 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true [release] # Regex to select git tags that represent releases. @@ -77,8 +78,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/.github/fixtures/test-keep-a-changelog-links-no-tags/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-no-tags/cliff.toml index 782e658e48..346c1fa284 100644 --- a/.github/fixtures/test-keep-a-changelog-links-no-tags/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-no-tags/cliff.toml @@ -1,5 +1,5 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -7,9 +7,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ {% if previous %}\ {% if previous.version %}\ @@ -36,12 +35,14 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true [release] # Regex to select git tags that represent releases. @@ -77,8 +78,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/.github/fixtures/test-keep-a-changelog-links-one-tag-bump-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-one-tag-bump-arg/cliff.toml index a48a642854..708fa79a09 100644 --- a/.github/fixtures/test-keep-a-changelog-links-one-tag-bump-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-one-tag-bump-arg/cliff.toml @@ -1,5 +1,5 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -7,9 +7,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ {% if previous %}\ {% if previous.version %}\ @@ -36,12 +35,14 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true [release] # Regex to select git tags that represent releases. @@ -77,8 +78,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/.github/fixtures/test-keep-a-changelog-links-one-tag/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-one-tag/cliff.toml index a48a642854..329f02e47c 100644 --- a/.github/fixtures/test-keep-a-changelog-links-one-tag/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-one-tag/cliff.toml @@ -1,5 +1,5 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -7,9 +7,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ {% if previous %}\ {% if previous.version %}\ @@ -36,12 +35,14 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true [release] # Regex to select git tags that represent releases. @@ -77,8 +78,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/.github/fixtures/test-keep-a-changelog-links-tag-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-tag-arg/cliff.toml index a48a642854..708fa79a09 100644 --- a/.github/fixtures/test-keep-a-changelog-links-tag-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-tag-arg/cliff.toml @@ -1,5 +1,5 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -7,9 +7,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ {% if previous %}\ {% if previous.version %}\ @@ -36,12 +35,14 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true [release] # Regex to select git tags that represent releases. @@ -77,8 +78,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/.github/fixtures/test-keep-a-changelog-links-unreleased-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-unreleased-arg/cliff.toml index a48a642854..708fa79a09 100644 --- a/.github/fixtures/test-keep-a-changelog-links-unreleased-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-unreleased-arg/cliff.toml @@ -1,5 +1,5 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -7,9 +7,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ {% if previous %}\ {% if previous.version %}\ @@ -36,12 +35,14 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true [release] # Regex to select git tags that represent releases. @@ -77,8 +78,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/.github/fixtures/test-keep-a-changelog-links/cliff.toml b/.github/fixtures/test-keep-a-changelog-links/cliff.toml index 21cf40ec74..3c64c83be1 100644 --- a/.github/fixtures/test-keep-a-changelog-links/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links/cliff.toml @@ -1,5 +1,5 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -7,9 +7,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ {% if previous %}\ {% if previous.version %}\ @@ -36,12 +35,14 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true [release] # Regex to select git tags that represent releases. @@ -77,8 +78,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/.github/fixtures/test-latest-with-one-tag/cliff.toml b/.github/fixtures/test-latest-with-one-tag/cliff.toml index 5504810e90..de3df0399f 100644 --- a/.github/fixtures/test-latest-with-one-tag/cliff.toml +++ b/.github/fixtures/test-latest-with-one-tag/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,9 +18,9 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-limit-commits/cliff.toml b/.github/fixtures/test-limit-commits/cliff.toml index b02c6cf1e7..1fb3fca66a 100644 --- a/.github/fixtures/test-limit-commits/cliff.toml +++ b/.github/fixtures/test-limit-commits/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # Whether to limit the total number of commits to be included in the changelog. diff --git a/.github/fixtures/test-no-exec/cliff.toml b/.github/fixtures/test-no-exec/cliff.toml index 416324da50..de18bd2559 100644 --- a/.github/fixtures/test-no-exec/cliff.toml +++ b/.github/fixtures/test-no-exec/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,13 +18,13 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true -# postprocessors +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A list of postprocessors using regex to modify the changelog. postprocessors = [ { pattern = '.*', replace_command = 'this_command_does_not_exist' }, ] diff --git a/.github/fixtures/test-order-by-topology-arg/cliff.toml b/.github/fixtures/test-order-by-topology-arg/cliff.toml index 5504810e90..de3df0399f 100644 --- a/.github/fixtures/test-order-by-topology-arg/cliff.toml +++ b/.github/fixtures/test-order-by-topology-arg/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,9 +18,9 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-order-by-topology/cliff.toml b/.github/fixtures/test-order-by-topology/cliff.toml index ad30d1e61e..3558d46067 100644 --- a/.github/fixtures/test-order-by-topology/cliff.toml +++ b/.github/fixtures/test-order-by-topology/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [release] # Whether to order releases chronologically or topologically. diff --git a/.github/fixtures/test-regex-replace-parser/cliff.toml b/.github/fixtures/test-regex-replace-parser/cliff.toml index 396c0d7d2d..9c495280ba 100644 --- a/.github/fixtures/test-regex-replace-parser/cliff.toml +++ b/.github/fixtures/test-regex-replace-parser/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-skip-breaking-changes/cliff.toml b/.github/fixtures/test-skip-breaking-changes/cliff.toml index 9f6a4a9289..8f23dc57a4 100644 --- a/.github/fixtures/test-skip-breaking-changes/cliff.toml +++ b/.github/fixtures/test-skip-breaking-changes/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -22,12 +21,12 @@ body = """ {% endfor %}\ {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-skip-commits/cliff.toml b/.github/fixtures/test-skip-commits/cliff.toml index 82a6473b90..47b901979d 100644 --- a/.github/fixtures/test-skip-commits/cliff.toml +++ b/.github/fixtures/test-skip-commits/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-split-commits/cliff.toml b/.github/fixtures/test-split-commits/cliff.toml index 6fe3ee243d..d7884012ab 100644 --- a/.github/fixtures/test-split-commits/cliff.toml +++ b/.github/fixtures/test-split-commits/cliff.toml @@ -1,12 +1,11 @@ [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -19,12 +18,12 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # Whether to split commits on newlines, treating each line as an individual commit. diff --git a/cliff.toml b/cliff.toml index 7960c3a281..be9eecaf57 100644 --- a/cliff.toml +++ b/cliff.toml @@ -6,13 +6,12 @@ # See documentation for more information on available options. [changelog] -# changelog header +# A static header for the changelog. header = """ [![animation](https://raw.githubusercontent.com/orhun/git-cliff/main/website/static/img/git-cliff-anim.gif)](https://git-cliff.org)\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {%- macro remote_url() -%} https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} {%- endmacro -%} @@ -50,16 +49,18 @@ body = """ {% endfor -%} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true -# postprocessors +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A list of postprocessors using regex to modify the changelog. postprocessors = [ { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL ] +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = false [release] # Regex to select git tags that represent releases. @@ -109,8 +110,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = false # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "beta|alpha" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/config/cliff.toml b/config/cliff.toml index 47336322b7..5a3a26293f 100644 --- a/config/cliff.toml +++ b/config/cliff.toml @@ -6,14 +6,13 @@ # See documentation for more information on available options. [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -28,16 +27,18 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing s -trim = true -# postprocessors +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A list of postprocessors using regex to modify the changelog. postprocessors = [ # { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL ] +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = false [release] # # Regex to select git tags that represent releases. @@ -87,8 +88,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = false # # Regex to select git tags that should be excluded from the changelog. # exclude_tags_pattern = "" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/examples/cocogitto.toml b/examples/cocogitto.toml index d026c4f440..0632180b33 100644 --- a/examples/cocogitto.toml +++ b/examples/cocogitto.toml @@ -2,14 +2,13 @@ # https://git-cliff.org/docs/configuration [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ --- {% if version %}\ {% if previous.version %}\ @@ -38,16 +37,18 @@ body = """ {% endfor -%} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true -# postprocessors +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A list of postprocessors using regex to modify the changelog. postprocessors = [ { pattern = '\$REPO', replace = "https://github.com/cocogitto/cocogitto" }, # replace repository URL ] +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = false [release] # Regex to select git tags that represent releases. @@ -90,8 +91,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = false # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/examples/detailed.toml b/examples/detailed.toml index 4cadfd39af..33ee9a1de4 100644 --- a/examples/detailed.toml +++ b/examples/detailed.toml @@ -2,14 +2,13 @@ # https://git-cliff.org/docs/configuration [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -31,12 +30,14 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = false [release] # Regex to select git tags that represent releases. @@ -77,8 +78,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = false # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/examples/github-keepachangelog.toml b/examples/github-keepachangelog.toml index faccbd7de6..1ca15c9212 100644 --- a/examples/github-keepachangelog.toml +++ b/examples/github-keepachangelog.toml @@ -2,7 +2,7 @@ # https://git-cliff.org/docs/configuration [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -10,9 +10,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {%- macro remote_url() -%} https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} {%- endmacro -%} @@ -47,8 +46,8 @@ body = """ {%- endif %} {%- endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ {%- macro remote_url() -%} https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} {%- endmacro -%} @@ -65,8 +64,10 @@ footer = """ {% endfor %} """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true [release] # Regex to select git tags that represent releases. @@ -107,8 +108,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/examples/github.toml b/examples/github.toml index d542cd16f5..5f953ef5f7 100644 --- a/examples/github.toml +++ b/examples/github.toml @@ -7,9 +7,8 @@ # token = "" [changelog] -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ ## What's Changed {%- if version %} in {{ version }}{%- endif -%} @@ -49,14 +48,16 @@ body = """ https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} {%- endmacro -%} """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# postprocessors +# A list of postprocessors using regex to modify the changelog. postprocessors = [] +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = false [release] # Regex to select git tags that represent releases. @@ -85,8 +86,6 @@ message_preprocessors = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = false # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "beta|alpha" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/examples/keepachangelog.toml b/examples/keepachangelog.toml index 26e4b70f97..d8d7fcdfc2 100644 --- a/examples/keepachangelog.toml +++ b/examples/keepachangelog.toml @@ -2,7 +2,7 @@ # https://git-cliff.org/docs/configuration [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file. @@ -10,9 +10,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version -%} ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else -%} @@ -25,8 +24,8 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ {% for release in releases -%} {% if release.version -%} {% if release.previous.version -%} @@ -41,8 +40,10 @@ footer = """ {% endfor %} """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = true [release] # Regex to select git tags that represent releases. @@ -78,8 +79,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = true # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/examples/minimal.toml b/examples/minimal.toml index 05c62b9f01..5f17fc404c 100644 --- a/examples/minimal.toml +++ b/examples/minimal.toml @@ -2,9 +2,8 @@ # https://git-cliff.org/docs/configuration [changelog] -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}\ {% else %}\ diff --git a/examples/scoped.toml b/examples/scoped.toml index bfa7fe0c18..8c7e92e36f 100644 --- a/examples/scoped.toml +++ b/examples/scoped.toml @@ -2,14 +2,13 @@ # https://git-cliff.org/docs/configuration [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -25,12 +24,14 @@ body = """ {% endfor %}\ {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = false [release] # Regex to select git tags that represent releases. @@ -68,8 +69,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = false # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/examples/scopesorted.toml b/examples/scopesorted.toml index 1770179767..176d85de36 100644 --- a/examples/scopesorted.toml +++ b/examples/scopesorted.toml @@ -2,14 +2,13 @@ # https://git-cliff.org/docs/configuration [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -38,12 +37,14 @@ body = """ {% raw %}\n{% endraw %}\ {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = false [release] # Regex to select git tags that represent releases. @@ -81,8 +82,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = false # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/examples/unconventional.toml b/examples/unconventional.toml index 7995e397fa..b212499167 100644 --- a/examples/unconventional.toml +++ b/examples/unconventional.toml @@ -2,14 +2,13 @@ # https://git-cliff.org/docs/configuration [changelog] -# changelog header +# A static header for the changelog. header = """ # Changelog\n All notable changes to this project will be documented in this file.\n """ -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ +# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). +body_template = """ {% if version %}\ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -22,12 +21,14 @@ body = """ {% endfor %} {% endfor %}\n """ -# template for the changelog footer -footer = """ +# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). +footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true +# Whether to exclude changes that do not belong to any group from the changelog. +exclude_ungrouped_changes = false [release] # Regex to select git tags that represent releases. @@ -66,8 +67,6 @@ commit_parsers = [ ] # Whether to prevent breaking changes from being excluded by commit parsers. retain_breaking_changes = false -# filter out the commits that are not matched by commit parsers -filter_commits = false # Regex to select git tags that should be excluded from the changelog. exclude_tags_pattern = "v0.1.0-beta.1" # Whether to order commits newest to oldest or oldest to newest in their group. diff --git a/git-cliff-core/src/changelog.rs b/git-cliff-core/src/changelog.rs index 40d95eae66..2703bc4703 100644 --- a/git-cliff-core/src/changelog.rs +++ b/git-cliff-core/src/changelog.rs @@ -1,5 +1,5 @@ use crate::commit::Commit; -use crate::config::Config; +use crate::config::models_v2::Config; use crate::error::Result; #[cfg(feature = "github")] use crate::github::{ @@ -34,19 +34,19 @@ pub struct Changelog<'a> { impl<'a> Changelog<'a> { /// Constructs a new instance. pub fn new(releases: Vec>, config: &'a Config) -> Result { - let trim = config.changelog.trim.unwrap_or(true); + let trim = config.changelog.trim_body_whitespace.unwrap_or(true); let mut changelog = Self { releases, body_template: Template::new( config .changelog - .body + .body_template .as_deref() .unwrap_or_default() .to_string(), trim, )?, - footer_template: match &config.changelog.footer { + footer_template: match &config.changelog.footer_template { Some(footer) => Some(Template::new(footer.to_string(), trim)?), None => None, }, @@ -81,16 +81,24 @@ impl<'a> Changelog<'a> { vec![commit] } }) - .filter_map(|commit| match commit.process(&self.config.commit) { - Ok(commit) => Some(commit), - Err(e) => { - trace!( - "{} - {} ({})", - commit.id[..7].to_string(), - e, - commit.message.lines().next().unwrap_or_default().trim() - ); - None + .filter_map(|commit| { + match commit.process(&self.config.changelog, &self.config.commit) + { + Ok(commit) => Some(commit), + Err(e) => { + trace!( + "{} - {} ({})", + commit.id[..7].to_string(), + e, + commit + .message + .lines() + .next() + .unwrap_or_default() + .trim() + ); + None + } } }) .collect::>(); @@ -307,7 +315,7 @@ impl<'a> Changelog<'a> { #[cfg(test)] mod test { use super::*; - use crate::config::{ + use crate::config::models_v2::{ Bump, ChangelogConfig, CommitConfig, @@ -326,8 +334,8 @@ mod test { fn get_test_data() -> (Config, Vec>) { let config = Config { changelog: ChangelogConfig { - header: Some(String::from("# Changelog")), - body: Some(String::from( + header: Some(String::from("# Changelog")), + body_template: Some(String::from( r#"{% if version %} ## Release [{{ version }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% if commit_id %}({{ commit_id }}){% endif %}{% else %} @@ -338,16 +346,17 @@ mod test { - {{ commit.message }}{% endfor %} {% endfor %}{% endfor %}"#, )), - footer: Some(String::from( + footer_template: Some(String::from( r#"-- total releases: {{ releases | length }} --"#, )), - trim: Some(true), - postprocessors: Some(vec![TextProcessor { + trim_body_whitespace: Some(true), + postprocessors: Some(vec![TextProcessor { pattern: Regex::new("boring") .expect("failed to compile regex"), replace: Some(String::from("exciting")), replace_command: None, }]), + exclude_ungrouped_changes: Some(false), }, release: ReleaseConfig { tags_pattern: None, @@ -479,7 +488,6 @@ mod test { }, ]), retain_breaking_changes: None, - filter_commits: Some(false), exclude_tags_pattern: Regex::new("v3.*").ok(), sort_order: Some(CommitSortOrder::Oldest), link_parsers: None, diff --git a/git-cliff-core/src/commit.rs b/git-cliff-core/src/commit.rs index 8e4272ad17..7235520c6c 100644 --- a/git-cliff-core/src/commit.rs +++ b/git-cliff-core/src/commit.rs @@ -1,4 +1,5 @@ -use crate::config::{ +use crate::config::models_v2::{ + ChangelogConfig, CommitConfig, CommitParser, LinkParser, @@ -180,26 +181,30 @@ impl Commit<'_> { /// * converts commit to a conventional commit /// * sets the group for the commit /// * extacts links and generates URLs - pub fn process(&self, config: &CommitConfig) -> Result { + pub fn process( + &self, + changelog_config: &ChangelogConfig, + commit_config: &CommitConfig, + ) -> Result { let mut commit = self.clone(); - if let Some(preprocessors) = &config.message_preprocessors { + if let Some(preprocessors) = &commit_config.message_preprocessors { commit = commit.preprocess(preprocessors)?; } - if config.parse_conventional_commits.unwrap_or(true) { - if config.exclude_unconventional_commits.unwrap_or(true) { + if commit_config.parse_conventional_commits.unwrap_or(true) { + if commit_config.exclude_unconventional_commits.unwrap_or(true) { commit = commit.into_conventional()?; } else if let Ok(conv_commit) = commit.clone().into_conventional() { commit = conv_commit; } } - if let Some(parsers) = &config.commit_parsers { + if let Some(parsers) = &commit_config.commit_parsers { commit = commit.parse( parsers, - config.retain_breaking_changes.unwrap_or(false), - config.filter_commits.unwrap_or(false), + commit_config.retain_breaking_changes.unwrap_or(false), + changelog_config.exclude_ungrouped_changes.unwrap_or(false), )?; } - if let Some(parsers) = &config.link_parsers { + if let Some(parsers) = &commit_config.link_parsers { commit = commit.parse_links(parsers)?; } Ok(commit) @@ -253,7 +258,7 @@ impl Commit<'_> { mut self, parsers: &[CommitParser], retain_breaking: bool, - filter: bool, + exclude_ungrouped: bool, ) -> Result { for parser in parsers { let mut regex_checks = Vec::new(); @@ -332,7 +337,7 @@ impl Commit<'_> { } } } - if !filter { + if !exclude_ungrouped { Ok(self) } else { Err(AppError::GroupError(String::from( @@ -487,7 +492,10 @@ mod test { #[test] fn conventional_footers() { - let cfg = crate::config::CommitConfig { + let changelog_config = crate::config::models_v2::ChangelogConfig { + ..Default::default() + }; + let commit_config = crate::config::models_v2::CommitConfig { parse_conventional_commits: Some(true), ..Default::default() }; @@ -532,7 +540,9 @@ mod test { ), ]; for (commit, footers) in &test_cases { - let commit = commit.process(&cfg).expect("commit should process"); + let commit = commit + .process(&changelog_config, &commit_config) + .expect("commit should process"); assert_eq!(&commit.footers().collect::>(), footers); } } diff --git a/git-cliff-core/src/config/mod.rs b/git-cliff-core/src/config/mod.rs new file mode 100644 index 0000000000..623c11366d --- /dev/null +++ b/git-cliff-core/src/config/mod.rs @@ -0,0 +1,9 @@ +/// Deprecated Config models for git-cliff. +pub mod models_v1; +/// Current Config models for git-cliff. +pub mod models_v2; +/// Parsing for git-cliff Config. +pub mod parsing; +/// Tests for git-cliff Config. +#[cfg(test)] +pub mod test; diff --git a/git-cliff-core/src/config/models_v1.rs b/git-cliff-core/src/config/models_v1.rs new file mode 100644 index 0000000000..920be43d20 --- /dev/null +++ b/git-cliff-core/src/config/models_v1.rs @@ -0,0 +1,88 @@ +use super::models_v2::{ + Bump, + CommitParser, + LinkParser, + RemoteConfig, + TextProcessor, +}; +use regex::Regex; +use serde::{ + Deserialize, + Serialize, +}; + +/// Configuration values. +#[deprecated(since = "3.0.0", note = "deprecated in favor of models_v2")] +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Config { + /// Configuration values about changelog generation. + #[allow(deprecated)] + #[serde(default)] + pub changelog: ChangelogConfig, + /// Configuration values about git. + #[allow(deprecated)] + #[serde(default)] + pub git: GitConfig, + /// Configuration values about remote. + #[serde(default)] + pub remote: RemoteConfig, + /// Configuration values about bump version. + #[serde(default)] + pub bump: Bump, +} + +/// Changelog configuration. +#[deprecated(since = "3.0.0", note = "deprecated in favor of models_v2")] +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct ChangelogConfig { + /// Changelog header. + pub header: Option, + /// Changelog body, template. + pub body: Option, + /// Changelog footer. + pub footer: Option, + /// Trim the template. + pub trim: Option, + /// Changelog postprocessors. + pub postprocessors: Option>, +} + +/// Git configuration +#[deprecated(since = "3.0.0", note = "deprecated in favor of models_v2")] +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct GitConfig { + /// Whether to enable parsing conventional commits. + pub conventional_commits: Option, + /// Whether to filter out unconventional commits. + pub filter_unconventional: Option, + /// Whether to split commits by line, processing each line as an individual + /// commit. + pub split_commits: Option, + + /// Git commit preprocessors. + pub commit_preprocessors: Option>, + /// Git commit parsers. + pub commit_parsers: Option>, + /// Whether to protect all breaking changes from being skipped by a commit + /// parser. + pub protect_breaking_commits: Option, + /// Link parsers. + pub link_parsers: Option>, + /// Whether to filter out commits. + pub filter_commits: Option, + /// Blob pattern for git tags. + #[serde(with = "serde_regex", default)] + pub tag_pattern: Option, + /// Regex to skip matched tags. + #[serde(with = "serde_regex", default)] + pub skip_tags: Option, + /// Regex to ignore matched tags. + #[serde(with = "serde_regex", default)] + pub ignore_tags: Option, + /// Whether to sort tags topologically. + pub topo_order: Option, + /// Sorting of the commits inside sections. + pub sort_commits: Option, + /// Limit the number of commits included in the changelog. + pub limit_commits: Option, +} diff --git a/git-cliff-core/src/config.rs b/git-cliff-core/src/config/models_v2.rs similarity index 70% rename from git-cliff-core/src/config.rs rename to git-cliff-core/src/config/models_v2.rs index 3bb8c9175f..f75148a27c 100644 --- a/git-cliff-core/src/config.rs +++ b/git-cliff-core/src/config/models_v2.rs @@ -1,26 +1,13 @@ use crate::command; use crate::error::Result; use clap::ValueEnum; -use regex::{ - Regex, - RegexBuilder, -}; +use regex::Regex; use secrecy::SecretString; use serde::{ Deserialize, Serialize, }; -use std::ffi::OsStr; use std::fmt; -use std::fs; -use std::path::Path; - -/// Regex for matching the metadata in Cargo.toml -const CARGO_METADATA_REGEX: &str = - r"^\[(?:workspace|package)\.metadata\.git\-cliff\."; - -/// Regex for matching the metadata in pyproject.toml -const PYPROJECT_METADATA_REGEX: &str = r"^\[(?:tool)\.git\-cliff\."; /// Options for ordering git tags. #[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum, Serialize, Deserialize)] @@ -65,16 +52,20 @@ pub struct Config { /// Changelog configuration. #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct ChangelogConfig { - /// Changelog header. - pub header: Option, - /// Changelog body, template. - pub body: Option, - /// Changelog footer. - pub footer: Option, - /// Trim the template. - pub trim: Option, - /// Changelog postprocessors. - pub postprocessors: Option>, + /// A static header for the changelog. + pub header: Option, + /// A Tera template to be rendered for each release in the changelog. + pub body_template: Option, + /// A Tera template to be rendered as the changelog's footer. + pub footer_template: Option, + /// Whether to remove leading and trailing whitespaces from all lines of the + /// changelog's body. + pub trim_body_whitespace: Option, + /// A list of postprocessors using regex to modify the changelog. + pub postprocessors: Option>, + /// Whether to exclude changes that do not belong to any group from the + /// changelog. + pub exclude_ungrouped_changes: Option, } /// Release configuration. @@ -119,8 +110,6 @@ pub struct CommitConfig { /// in commit messages, and turning them into links. The gemerated links can /// be used in the body template as `commit.links`. pub link_parsers: Option>, - /// Whether to filter out commits. - pub filter_commits: Option, /// Regex to select git tags that should be excluded from the changelog. #[serde(with = "serde_regex", default)] pub exclude_tags_pattern: Option, @@ -272,97 +261,48 @@ pub struct LinkParser { } impl Config { - /// Parses the config file and returns the values. - pub fn parse(path: &Path) -> Result { - let config_builder = if path.file_name() == Some(OsStr::new("Cargo.toml")) || - path.file_name() == Some(OsStr::new("pyproject.toml")) - { - let contents = fs::read_to_string(path)?; - let metadata_regex = RegexBuilder::new( - if path.file_name() == Some(OsStr::new("Cargo.toml")) { - CARGO_METADATA_REGEX + /// Creates a v2 Config from a deprecated v1 Config. + #[allow(deprecated)] + pub fn from(config_v1: super::models_v1::Config) -> Config { + Config { + changelog: ChangelogConfig { + header: config_v1.changelog.header, + body_template: config_v1.changelog.body, + footer_template: config_v1.changelog.footer, + trim_body_whitespace: config_v1.changelog.trim, + postprocessors: config_v1.changelog.postprocessors, + exclude_ungrouped_changes: config_v1.git.filter_commits, + }, + release: ReleaseConfig { + tags_pattern: config_v1.git.tag_pattern, + skip_tags_pattern: config_v1.git.ignore_tags, + order_by: Some(if config_v1.git.topo_order.unwrap() { + TagsOrderBy::Topology } else { - PYPROJECT_METADATA_REGEX - }, - ) - .multi_line(true) - .build()?; - let contents = metadata_regex.replace_all(&contents, "["); - config::Config::builder().add_source(config::File::from_str( - &contents, - config::FileFormat::Toml, - )) - } else { - config::Config::builder().add_source(config::File::from(path)) - }; - Ok(config_builder - .add_source( - config::Environment::with_prefix("GIT_CLIFF").separator("__"), - ) - .build()? - .try_deserialize()?) - } -} - -#[cfg(test)] -mod test { - use super::*; - use pretty_assertions::assert_eq; - use std::env; - use std::path::PathBuf; - #[test] - fn parse_config() -> Result<()> { - let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .parent() - .expect("parent directory not found") - .to_path_buf() - .join("config") - .join(crate::DEFAULT_CONFIG); - - const FOOTER_VALUE: &str = "test"; - const RELEASE_TAGS_PATTERN_VALUE: &str = ".*[0-9].*"; - const RELEASE_SKIP_TAGS_PATTERN_VALUE: &str = - "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"; - - env::set_var("GIT_CLIFF__CHANGELOG__FOOTER", FOOTER_VALUE); - env::set_var( - "GIT_CLIFF__RELEASE__TAGS_PATTERN", - RELEASE_TAGS_PATTERN_VALUE, - ); - env::set_var( - "GIT_CLIFF__RELEASE__SKIP_TAGS_PATTERN", - RELEASE_SKIP_TAGS_PATTERN_VALUE, - ); - - let config = Config::parse(&path)?; - - assert_eq!(Some(String::from(FOOTER_VALUE)), config.changelog.footer); - assert_eq!( - Some(String::from(RELEASE_TAGS_PATTERN_VALUE)), - config - .release - .tags_pattern - .map(|tags_pattern| tags_pattern.to_string()) - ); - assert_eq!( - Some(String::from(RELEASE_SKIP_TAGS_PATTERN_VALUE)), - config - .release - .skip_tags_pattern - .map(|skip_tags_pattern| skip_tags_pattern.to_string()) - ); - Ok(()) - } - - #[test] - fn remote_config() { - let remote1 = Remote::new("abc", "xyz1"); - let remote2 = Remote::new("abc", "xyz2"); - assert!(!remote1.eq(&remote2)); - assert_eq!("abc/xyz1", remote1.to_string()); - assert!(remote1.is_set()); - assert!(!Remote::new("", "test").is_set()); - assert!(!Remote::new("test", "").is_set()); - assert!(!Remote::new("", "").is_set()); + TagsOrderBy::Time + }), + }, + commit: CommitConfig { + sort_order: config_v1.git.sort_commits.map( + |s| { + CommitSortOrder::from_str(&s, true) + .expect("Incorrect config value for 'sort_commits'") + }, + ), + max_commit_count: config_v1.git.limit_commits, + split_by_newline: config_v1.git.split_commits, + exclude_tags_pattern: config_v1.git.skip_tags, + message_preprocessors: config_v1.git.commit_preprocessors, + link_parsers: config_v1.git.link_parsers, + parse_conventional_commits: config_v1.git.conventional_commits, + exclude_unconventional_commits: config_v1.git.filter_unconventional, + commit_parsers: config_v1.git.commit_parsers, + retain_breaking_changes: config_v1 + .git + .protect_breaking_commits, + }, + remote: config_v1.remote.clone(), + bump: config_v1.bump.clone(), + } } } diff --git a/git-cliff-core/src/config/parsing.rs b/git-cliff-core/src/config/parsing.rs new file mode 100644 index 0000000000..e2ae190721 --- /dev/null +++ b/git-cliff-core/src/config/parsing.rs @@ -0,0 +1,44 @@ +use crate::error::Result; +use regex::RegexBuilder; +use serde::Deserialize; +use std::{ + ffi::OsStr, + fs, + path::Path, +}; + +/// Regex for matching the metadata in Cargo.toml +const CARGO_METADATA_REGEX: &str = + r"^\[(?:workspace|package)\.metadata\.git\-cliff\."; + +/// Regex for matching the metadata in pyproject.toml +const PYPROJECT_METADATA_REGEX: &str = r"^\[(?:tool)\.git\-cliff\."; + +/// Loads configuration from a file and GIT_CLIFF_* environment variables. +pub fn parse<'de, T: Deserialize<'de>>(path: &Path) -> Result { + let file_name = path.file_name(); + let config_builder = if file_name == Some(OsStr::new("Cargo.toml")) || + file_name == Some(OsStr::new("pyproject.toml")) + { + let contents = fs::read_to_string(path)?; + let metadata_regex = RegexBuilder::new( + if path.file_name() == Some(OsStr::new("Cargo.toml")) { + CARGO_METADATA_REGEX + } else { + PYPROJECT_METADATA_REGEX + }, + ) + .multi_line(true) + .build()?; + let contents = metadata_regex.replace_all(&contents, "["); + config::Config::builder() + .add_source(config::File::from_str(&contents, config::FileFormat::Toml)) + } else { + config::Config::builder().add_source(config::File::from(path)) + }; + + Ok(config_builder + .add_source(config::Environment::with_prefix("GIT_CLIFF").separator("__")) + .build()? + .try_deserialize()?) +} diff --git a/git-cliff-core/src/config/test.rs b/git-cliff-core/src/config/test.rs new file mode 100644 index 0000000000..5a986cef07 --- /dev/null +++ b/git-cliff-core/src/config/test.rs @@ -0,0 +1,66 @@ +use super::models_v2::{ + Config, + Remote, +}; +use crate::config::parsing; +use crate::error::Result; +use std::env; +use std::path::PathBuf; + +#[test] +fn parse_config() -> Result<()> { + let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .parent() + .expect("parent directory not found") + .to_path_buf() + .join("config") + .join(crate::DEFAULT_CONFIG); + + const FOOTER_VALUE: &str = "test"; + const RELEASE_TAGS_PATTERN_VALUE: &str = ".*[0-9].*"; + const RELEASE_SKIP_TAGS_PATTERN_VALUE: &str = "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"; + + env::set_var("GIT_CLIFF__CHANGELOG__FOOTER_TEMPLATE", FOOTER_VALUE); + env::set_var( + "GIT_CLIFF__RELEASE__TAGS_PATTERN", + RELEASE_TAGS_PATTERN_VALUE, + ); + env::set_var( + "GIT_CLIFF__RELEASE__SKIP_TAGS_PATTERN", + RELEASE_SKIP_TAGS_PATTERN_VALUE, + ); + + let config = parsing::parse::(&path)?; + + assert_eq!( + Some(String::from(FOOTER_VALUE)), + config.changelog.footer_template + ); + assert_eq!( + Some(String::from(RELEASE_TAGS_PATTERN_VALUE)), + config + .release + .tags_pattern + .map(|tags_pattern| tags_pattern.to_string()) + ); + assert_eq!( + Some(String::from(RELEASE_SKIP_TAGS_PATTERN_VALUE)), + config + .release + .skip_tags_pattern + .map(|skip_tags_pattern| skip_tags_pattern.to_string()) + ); + Ok(()) +} + +#[test] +fn remote_config() { + let remote1 = Remote::new("abc", "xyz1"); + let remote2 = Remote::new("abc", "xyz2"); + assert!(!remote1.eq(&remote2)); + assert_eq!("abc/xyz1", remote1.to_string()); + assert!(remote1.is_set()); + assert!(!Remote::new("", "test").is_set()); + assert!(!Remote::new("test", "").is_set()); + assert!(!Remote::new("", "").is_set()); +} diff --git a/git-cliff-core/src/embed.rs b/git-cliff-core/src/embed.rs index c4b18275cb..9707866562 100644 --- a/git-cliff-core/src/embed.rs +++ b/git-cliff-core/src/embed.rs @@ -1,4 +1,4 @@ -use crate::config::Config; +use crate::config::models_v2::Config; use crate::error::{ Error, Result, diff --git a/git-cliff-core/src/github.rs b/git-cliff-core/src/github.rs index 4548814604..73e9ad162e 100644 --- a/git-cliff-core/src/github.rs +++ b/git-cliff-core/src/github.rs @@ -1,4 +1,4 @@ -use crate::config::Remote; +use crate::config::models_v2::Remote; use crate::error::*; use futures::{ future, diff --git a/git-cliff-core/src/release.rs b/git-cliff-core/src/release.rs index 34a5c40557..d9b25606dc 100644 --- a/git-cliff-core/src/release.rs +++ b/git-cliff-core/src/release.rs @@ -1,5 +1,5 @@ use crate::commit::Commit; -use crate::config::Bump; +use crate::config::models_v2::Bump; use crate::error::Result; #[cfg(feature = "github")] use crate::github::{ diff --git a/git-cliff-core/src/repo.rs b/git-cliff-core/src/repo.rs index d4c5fe8e84..d52b106677 100644 --- a/git-cliff-core/src/repo.rs +++ b/git-cliff-core/src/repo.rs @@ -1,4 +1,4 @@ -use crate::config::{ +use crate::config::models_v2::{ Remote, TagsOrderBy, }; diff --git a/git-cliff-core/src/template.rs b/git-cliff-core/src/template.rs index d4542c8fa4..6db4a67fd0 100644 --- a/git-cliff-core/src/template.rs +++ b/git-cliff-core/src/template.rs @@ -1,5 +1,5 @@ use crate::{ - config::TextProcessor, + config::models_v2::TextProcessor, error::{ Error, Result, diff --git a/git-cliff-core/tests/integration_test.rs b/git-cliff-core/tests/integration_test.rs index 28369bd040..db34bc54ca 100644 --- a/git-cliff-core/tests/integration_test.rs +++ b/git-cliff-core/tests/integration_test.rs @@ -2,7 +2,7 @@ use git_cliff_core::commit::{ Commit, Signature, }; -use git_cliff_core::config::{ +use git_cliff_core::config::models_v2::{ ChangelogConfig, CommitConfig, CommitParser, @@ -20,8 +20,8 @@ use std::fmt::Write; #[test] fn generate_changelog() -> Result<()> { let changelog_config = ChangelogConfig { - header: Some(String::from("this is a changelog")), - body: Some(String::from( + header: Some(String::from("this is a changelog")), + body_template: Some(String::from( r#" ## Release {{ version }} - {% for group, commits in commits | group_by(attribute="group") %} @@ -38,9 +38,10 @@ fn generate_changelog() -> Result<()> { {% endfor -%} {% endfor %}"#, )), - footer: Some(String::from("eoc - end of changelog")), - trim: None, - postprocessors: None, + footer_template: Some(String::from("eoc - end of changelog")), + trim_body_whitespace: None, + postprocessors: None, + exclude_ungrouped_changes: Some(true), }; let commit_config = CommitConfig { parse_conventional_commits: Some(true), @@ -109,7 +110,6 @@ fn generate_changelog() -> Result<()> { }, ]), retain_breaking_changes: None, - filter_commits: Some(true), exclude_tags_pattern: None, sort_order: None, link_parsers: Some(vec![ @@ -180,7 +180,7 @@ fn generate_changelog() -> Result<()> { commit_with_author ] .iter() - .filter_map(|c| c.process(&commit_config).ok()) + .filter_map(|c| c.process(&changelog_config, &commit_config).ok()) .collect::>(), commit_id: None, timestamp: 0, @@ -221,14 +221,15 @@ fn generate_changelog() -> Result<()> { ]; let out = &mut String::new(); - let template = Template::new(changelog_config.body.unwrap(), false)?; + let body_template = + Template::new(changelog_config.body_template.unwrap(), false)?; writeln!(out, "{}", changelog_config.header.unwrap()).unwrap(); for release in releases { write!( out, "{}", - template.render( + body_template.render( &release, Option::>::None.as_ref(), &[TextProcessor { @@ -240,7 +241,7 @@ fn generate_changelog() -> Result<()> { ) .unwrap(); } - writeln!(out, "{}", changelog_config.footer.unwrap()).unwrap(); + writeln!(out, "{}", changelog_config.footer_template.unwrap()).unwrap(); assert_eq!( r#"this is a changelog diff --git a/git-cliff/src/args.rs b/git-cliff/src/args.rs index ed8ea57836..b7d75df61c 100644 --- a/git-cliff/src/args.rs +++ b/git-cliff/src/args.rs @@ -13,7 +13,7 @@ use clap::{ ValueEnum, }; use git_cliff_core::{ - config::{ + config::models_v2::{ CommitSortOrder, Remote, TagsOrderBy, @@ -183,15 +183,15 @@ pub struct Opt { /// Prints bumped version for unreleased changes. #[arg(long, help_heading = Some("FLAGS"))] pub bumped_version: bool, - /// Sets the template for the changelog body. + /// Sets the Tera template to be rendered for each release in the changelog. #[arg( short, long, - env = "GIT_CLIFF_TEMPLATE", + env = "GIT_CLIFF_BODY_TEMPLATE", value_name = "TEMPLATE", allow_hyphen_values = true )] - pub body: Option, + pub body_template: Option, /// Processes the commits starting from the latest tag. #[arg(short, long, help_heading = Some("FLAGS"))] pub latest: bool, diff --git a/git-cliff/src/lib.rs b/git-cliff/src/lib.rs index df6e2ec3d3..bafb44511c 100644 --- a/git-cliff/src/lib.rs +++ b/git-cliff/src/lib.rs @@ -19,12 +19,13 @@ use args::{ }; use git_cliff_core::changelog::Changelog; use git_cliff_core::commit::Commit; -use git_cliff_core::config::{ +use git_cliff_core::config::models_v2::{ CommitParser, CommitSortOrder, Config, TagsOrderBy, }; +use git_cliff_core::config::parsing; use git_cliff_core::embed::{ BuiltinConfig, EmbeddedConfig, @@ -349,7 +350,7 @@ pub fn run(mut args: Opt) -> Result<()> { info!("Using built-in configuration file: {name}"); config } else if path.exists() { - Config::parse(&path)? + parsing::parse(&path)? } else { if !args.context { warn!( @@ -359,9 +360,13 @@ pub fn run(mut args: Opt) -> Result<()> { } EmbeddedConfig::parse()? }; - if config.changelog.body.is_none() && !args.context { - warn!("Changelog body is not specified, using the default template."); - config.changelog.body = EmbeddedConfig::parse()?.changelog.body; + if config.changelog.body_template.is_none() && !args.context { + warn!( + "Option `changelog.body_template` is not specified, using the default \ + template." + ); + config.changelog.body_template = + EmbeddedConfig::parse()?.changelog.body_template; } // Update the configuration based on command line arguments and vice versa. @@ -370,24 +375,27 @@ pub fn run(mut args: Opt) -> Result<()> { config.changelog.header = None; } Some(Strip::Footer) => { - config.changelog.footer = None; + config.changelog.footer_template = None; } Some(Strip::All) => { config.changelog.header = None; - config.changelog.footer = None; + config.changelog.footer_template = None; } None => {} } if args.prepend.is_some() { - config.changelog.footer = None; + config.changelog.footer_template = None; if !(args.unreleased || args.latest || args.range.is_some()) { return Err(Error::ArgumentError(String::from( "'-u' or '-l' is not specified", ))); } } - if args.body.is_some() { - config.changelog.body.clone_from(&args.body); + if args.body_template.is_some() { + config + .changelog + .body_template + .clone_from(&args.body_template); } if args.commit_sort_order == CommitSortOrder::Oldest { if let Some(commit_sort_order) = config.commit.sort_order { diff --git a/release.sh b/release.sh index ff741cba1c..317cd211a6 100755 --- a/release.sh +++ b/release.sh @@ -21,7 +21,7 @@ cargo run -- --config cliff.toml --tag "$1" >CHANGELOG.md git add -A && git commit -m "chore(release): prepare for $1" git show # generate a changelog for the tag message -export GIT_CLIFF_TEMPLATE="\ +export GIT_CLIFF_BODY_TEMPLATE="\ {% for group, commits in commits | group_by(attribute=\"group\") %} {{ group | upper_first }}\ {% for commit in commits %} diff --git a/website/docs/configuration/changelog.md b/website/docs/configuration/changelog.md index 1fe75c2f96..2942eea1e5 100644 --- a/website/docs/configuration/changelog.md +++ b/website/docs/configuration/changelog.md @@ -7,7 +7,7 @@ This section contains the configuration options for changelog generation. ```toml [changelog] header = "Changelog" -body = """ +body_template = """ {% for group, commits in commits | group_by(attribute="group") %} ### {{ group | upper_first }} {% for commit in commits %} @@ -15,41 +15,46 @@ body = """ {% endfor %} {% endfor %} """ -trim = true -footer = "" +trim_body_whitespace = true +footer_template = "" postprocessors = [{ pattern = "foo", replace = "bar"}] +exclude_ungrouped_changes = false ``` ### header -Header text that will be added to the beginning of the changelog. +A static header that will be added to the beginning of the changelog. -### body +### body_template -Body template that represents a single release in the changelog. +A Tera template to be rendered for each release in the changelog. See [templating](/docs/category/templating) for more detail. -### footer +### footer_template -Footer template that will be rendered and added to the end of the changelog. +A Tera template that will be rendered and added to the end of the changelog. -The template context is the same as [`body`](#body) and contains all the releases instead of a single release. +The template context is the same as [`body_template`](#body_template) and contains all the releases instead of a single release. -For example, to get the list of releases, use the `{{ releases }}` variable in the template. To get information about a single release, iterate over this array and access the fields similar to [`body`](#body). +For example, to get the list of releases, use the `{{ releases }}` variable in the template. To get information about a single release, iterate over this array and access the fields similar to [`body_template`](#body_template). See [Keep a Changelog configuration](/docs/templating/examples#keep-a-changelog) for seeing the example of adding links to the end of the changelog. -### trim +### trim_body_whitespace -If set to `true`, leading and trailing whitespace are removed from the [`body`](#body). +If set to `true`, leading and trailing whitespace are removed from every line in the rendered [`body_template`](#body_template). It is useful for adding indentation to the template for readability, as shown [in the example](#changelog). ### postprocessors -An array of commit postprocessors for manipulating the changelog before outputting. +A list of postprocessors using regex to modify the changelog. Can e.g. be used for replacing commit author with GitHub usernames. Internally postprocessors and preprocessors are the same. See [commit.message_preprocessors](/docs/configuration/commit#message_preprocessors) for more detail and examples, it uses the same syntax. + +### exclude_ungrouped_changes + +If set to `true`, commits that do not have a group assigned to them by either [`commit.parse_conventional_commits`](/docs/configuration/commit#parse_conventional_commits) or [`commit.commit_parsers`](/docs/configuration/commit#commit_parsers) are excluded from the changelog. diff --git a/website/docs/configuration/commit.md b/website/docs/configuration/commit.md index 7fd6922781..b666a7cfbd 100644 --- a/website/docs/configuration/commit.md +++ b/website/docs/configuration/commit.md @@ -17,7 +17,6 @@ commit_parsers = [ { message = "^test", group = "Testing"}, ] retain_breaking_changes = false -filter_commits = false exclude_tags_pattern = "v0.1.0-beta.1" sort_order = "oldest" @@ -173,10 +172,6 @@ Examples: If set to `true`, any breaking changes will be protected against being excluded by commit parsers. -### filter_commits - -If set to `true`, commits that are not matched by [`commit_parsers`](#commit_parsers) are filtered out. - ### exclude_tags_pattern Regex to select git tags that should be excluded from the changelog. diff --git a/website/docs/integration/python.md b/website/docs/integration/python.md index 438fbdfc6a..54e021bccf 100644 --- a/website/docs/integration/python.md +++ b/website/docs/integration/python.md @@ -13,13 +13,13 @@ dependencies = [] [tool.git-cliff.changelog] header = "All notable changes to this project will be documented in this file." -body = "..." -footer = "" +body_template = "..." +footer_template = "" +exclude_ungrouped_changes = false # see [changelog] section for more keys [tool.git-cliff.commit] parse_conventional_commits = true commit_parsers = [] -filter_commits = false # see [commit] section for more keys ``` diff --git a/website/docs/integration/rust.md b/website/docs/integration/rust.md index 6dc49c1f90..88f3c46073 100644 --- a/website/docs/integration/rust.md +++ b/website/docs/integration/rust.md @@ -14,14 +14,14 @@ name = "..." [package.metadata.git-cliff.changelog] header = "All notable changes to this project will be documented in this file." -body = "..." -footer = "" +body_template = "..." +footer_template = "" +exclude_ungrouped_changes = false # see [changelog] section for more keys [package.metadata.git-cliff.commit] conventional_commits = true commit_parsers = [] -filter_commits = false # see [commit] section for more keys ``` diff --git a/website/docs/usage/args.md b/website/docs/usage/args.md index 7df92c3e9a..b3235dfab9 100644 --- a/website/docs/usage/args.md +++ b/website/docs/usage/args.md @@ -39,7 +39,7 @@ git-cliff [FLAGS] [OPTIONS] [--] [RANGE] -p, --prepend Prepends entries to the given changelog file [env: GIT_CLIFF_PREPEND=] -o, --output [] Writes output to the given file [env: GIT_CLIFF_OUTPUT=] -t, --tag Sets the tag for the latest version [env: GIT_CLIFF_TAG=] --b, --body