Skip to content

Commit

Permalink
fix: add support for special characters in scopes
Browse files Browse the repository at this point in the history
Fixes #25
  • Loading branch information
pataar committed Oct 19, 2021
1 parent f447cc2 commit bf146cf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion git-cliff-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ default-features = false
features = ["toml", "yaml"]

[dependencies.git-conventional]
version = "0.10.2"
version = "0.11.0"
features = ["serde"]

[dependencies.rust-embed]
Expand Down
31 changes: 23 additions & 8 deletions git-cliff-core/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,24 @@ fn generate_changelog() -> Result<()> {
## Release {{ version }}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group }}
{% for commit in commits %}
- {{ commit.message }}{% endfor %}
{% endfor %}"#,
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
- *({{commit.scope}})* {{ commit.message }}
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}
{%- endfor -%}
{%- for commit in commits %}
{%- if commit.scope -%}
{% else -%}
- {{ commit.message }}
{% if commit.breaking -%}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{% endif -%}
{% endif -%}
{% endfor -%}
{% endfor %}"#,
),
footer: Some(String::from("eoc - end of changelog")),
trim: None,
Expand Down Expand Up @@ -56,7 +71,9 @@ fn generate_changelog() -> Result<()> {
commits: vec![
Commit::new(String::from("abc123"), String::from("feat: add xyz")),
Commit::new(String::from("abc124"), String::from("feat: add zyx")),
Commit::new(String::from("abc124"), String::from("feat(random-scope): add random feature")),
Commit::new(String::from("def789"), String::from("invalid commit")),
Commit::new(String::from("def789"), String::from("feat(big-feature)!: this is a breaking change")),
Commit::new(String::from("qwerty"), String::from("fix: fix abc")),
Commit::new(
String::from("qwop"),
Expand Down Expand Up @@ -122,26 +139,24 @@ fn generate_changelog() -> Result<()> {
## Release v2.0.0
### fix bugs
- fix abc
### shiny features
- add xyz
- *(big-feature)* this is a breaking change
- **BREAKING**: this is a breaking change
- *(random-scope)* add random feature- add xyz
- add zyx
## Release v1.0.0
### chore
- do nothing
### feat
- add cool features
### fix
- fix stuff
- fix more stuff
eoc - end of changelog\n",
Expand Down

0 comments on commit bf146cf

Please sign in to comment.