-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conventional commit types should be case insensitive #444
Comments
I am unable to reproduce this. cd $(mktemp -d)
git init
git commit --allow-empty -m "feat: initial"
git commit --allow-empty -m "Feat: 2nd commit"
git commit --allow-empty -m "FEAT: this won't show up"
git commit --allow-empty -m "FeAt(something): TEST"
git cliff # Changelog
All notable changes to this project will be documented in this file.
## [unreleased]
### FEAT
- This won't show up
### FeAt
- TEST
### Feat
- 2nd commit
### Features
- Initial
<!-- generated by git-cliff --> Maybe it is a |
❯ git cliff
# Changelog
All notable changes to this project will be documented in this file.
## [unreleased]
### Documentation
- [f127fde](https://github.com/joshka/tui-big-text/commit/f127fde7e945310d77aed010fb2198eecd555dc5)
Improve examples
### Miscellaneous Tasks
- [70490cd](https://github.com/joshka/tui-big-text/commit/70490cd39380dd06b175e37bf9be2555a1cb1872)
Clean up links
- [9fcf4ff](https://github.com/joshka/tui-big-text/commit/9fcf4ffbb5ea9e44dad2724ee51f33b22bff6361)
More cleanup
## [0.3.1](https://github.com/joshka/tui-big-text/releases/tag/v0.3.1) - 2023-12-23
### Documentation
- [bc3cd46](https://github.com/joshka/tui-big-text/commit/bc3cd46a8f2e34ae65054b6191e9475d477612c1)
Update example image (#20)
## [0.3.0](https://github.com/joshka/tui-big-text/releases/tag/v0.3.0) - 2023-12-23
... Cliff.toml: # git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.
[changelog]
# changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.
"""
# template for the changelog body
# https://tera.netlify.app/docs
body = """
{% set repo = "https://github.com/joshka/tui-big-text/" -%}
{%- if version %}
## [{{ version | trim_start_matches(pat="v") }}]({{ repo ~ "releases/tag/" ~ version }}) \
- {{ timestamp | date(format="%Y-%m-%d") }}
{%- else %}
## [unreleased]
{%- endif %}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- [{{ commit.id | truncate(length=7, end="") }}]({{ repo ~ "commit/" ~ commit.id }})
{% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
{%- if commit.body %}
````text {#- 4 backticks escape any backticks in body #}
{{commit.body | indent(prefix=" ") }}
````
{%- endif -%}
{% endfor %}
{% endfor %}
"""
# remove the leading and trailing whitespace from the template
trim = false
# changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = false
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"}, # replace issue numbers
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^(doc|docs)", group = "Documentation" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor" },
{ message = "^style", group = "Styling" },
{ message = "^test", group = "Testing" },
{ message = "^chore: release", skip = true },
{ message = "^chore\\(deps\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|ci", group = "Miscellaneous Tasks" },
{ body = ".*security", group = "Security" },
{ message = "^revert", group = "Revert" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = true
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# limit the number of commits included in the changelog.
# limit_commits = 42 Looks like my config is a little outdated. I think perhaps the filter_commits setting was the culprit. Diff from current default cliff.toml: diff --git a/cliff.toml b/cliff.toml
index 5790a36..7beeaca 100644
--- a/cliff.toml
+++ b/cliff.toml
@@ -9,34 +9,25 @@
# changelog header
header = """
# Changelog\n
-All notable changes to this project will be documented in this file.
+All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
-# https://tera.netlify.app/docs
+# https://keats.github.io/tera/docs/#introduction
body = """
-{% set repo = "https://github.com/joshka/tui-big-text/" -%}
-{%- if version %}
-## [{{ version | trim_start_matches(pat="v") }}]({{ repo ~ "releases/tag/" ~ version }}) \
- - {{ timestamp | date(format="%Y-%m-%d") }}
-{%- else %}
-## [unreleased]
-{%- endif %}
+{% if version %}\
+ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
+{% else %}\
+ ## [unreleased]
+{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
-### {{ group | upper_first }}
-{% for commit in commits %}
-- [{{ commit.id | truncate(length=7, end="") }}]({{ repo ~ "commit/" ~ commit.id }})
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
- {%- if commit.body %}
-
- ````text {#- 4 backticks escape any backticks in body #}
- {{commit.body | indent(prefix=" ") }}
- ````
- {%- endif -%}
-{% endfor %}
-{% endfor %}
+ ### {{ group | upper_first }}
+ {% for commit in commits %}
+ - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
+ {% endfor %}
+{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
-trim = false
+trim = true
# changelog footer
footer = """
<!-- generated by git-cliff -->
@@ -49,7 +40,7 @@ postprocessors = [
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
-filter_unconventional = false
+filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
@@ -60,12 +51,12 @@ commit_preprocessors = [
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
- { message = "^(doc|docs)", group = "Documentation" },
+ { message = "^doc", group = "Documentation" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor" },
{ message = "^style", group = "Styling" },
{ message = "^test", group = "Testing" },
- { message = "^chore: release", skip = true },
+ { message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
@@ -76,9 +67,10 @@ commit_parsers = [
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
-filter_commits = true
-# glob pattern for matching git tags
-tag_pattern = "v[0-9]*"
+filter_commits = false
+# regex for matching git tags
+tag_pattern = "v[0-9].*"
+
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
# regex for ignoring tags With the default, I now see this: ❯ git cliff
# Changelog
All notable changes to this project will be documented in this file.
## [unreleased]
### Documentation
- Improve examples
### Feat
- Add PixelSize option (#22)
### Miscellaneous Tasks
- Clean up links
- More cleanup Which at least doesn't filter out the Feat now, but that should still be a case insensitive match and end up under Features not Feat. |
Yeah, the issue is: commit_parsers = [
{ message = "^feat", group = "Features" },
]
filter_commits = true You can do this instead: commit_parsers = [
{ message = "^[fF]eat", group = "Features" },
]
filter_commits = false |
If we wanted all matches to be case insensitive, where could we add a modifier to the regexes? Would a field to handle that be more appropriate? I think that should be the default behavior based on the spec. |
Describe the bug
I noticed a missing commit (using just the default config) that was due to the type being capitalized.
https://www.conventionalcommits.org/en/v1.0.0/#are-the-types-in-the-commit-title-uppercase-or-lowercase
To reproduce
Make a commit titled e.g.
FEAT: this won't show up
Expected behavior
Commit type detection should ignore case as this is easy to overlook in a commit message.
Screenshots / Logs
Software information
Additional context
The text was updated successfully, but these errors were encountered: