Skip to content
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

fix(changelog): add support for special characters in scopes #26

Merged
merged 3 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
54 changes: 34 additions & 20 deletions git-cliff-core/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ fn generate_changelog() -> Result<()> {
r#"
## Release {{ version }}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group }}
### {{ group }}
{% for commit in commits %}
- {{ commit.message }}{% endfor %}
{% endfor %}"#,
{%- if commit.scope -%}
- *({{commit.scope}})* {{ commit.message }}
{% else -%}
- {{ commit.message }}
{% endif -%}
{% if commit.breaking -%}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{% endif -%}
{% endfor -%}
{% endfor %}"#,
),
footer: Some(String::from("eoc - end of changelog")),
trim: None,
Expand Down Expand Up @@ -56,7 +64,15 @@ 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 @@ -121,29 +137,27 @@ fn generate_changelog() -> Result<()> {

## Release v2.0.0

### fix bugs

- fix abc
### fix bugs
- fix abc

### shiny features

- add xyz
- add zyx
### shiny features
- add xyz
- add zyx
- *(random-scope)* add random feature
- *(big-feature)* this is a breaking change
- **BREAKING**: this is a breaking change

## Release v1.0.0

### chore

- do nothing

### feat

- add cool features
### chore
- do nothing

### fix
### feat
- add cool features

- fix stuff
- fix more stuff
### fix
- fix stuff
- fix more stuff
eoc - end of changelog\n",
out
);
Expand Down