diff --git a/Cargo.lock b/Cargo.lock index 8322fceae4..60aa61b955 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -358,9 +358,9 @@ dependencies = [ [[package]] name = "git-conventional" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc574c897f85ed0a16517cb9318409cd4f8213475c25ffd413bedb2c4d917def" +checksum = "b6fba08a8b40d1967e1396a2b42680af39da750a6e28476f48b5ca4033f15f27" dependencies = [ "doc-comment", "nom 7.0.0", diff --git a/git-cliff-core/Cargo.toml b/git-cliff-core/Cargo.toml index 12e0a74d20..eb695179c8 100644 --- a/git-cliff-core/Cargo.toml +++ b/git-cliff-core/Cargo.toml @@ -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] diff --git a/git-cliff-core/tests/integration_test.rs b/git-cliff-core/tests/integration_test.rs index ac8a0221d9..3152a852c0 100644 --- a/git-cliff-core/tests/integration_test.rs +++ b/git-cliff-core/tests/integration_test.rs @@ -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, @@ -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"), @@ -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",