feat: enable commit bodies in changelog and fixes general warnings and updates
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
2025-01-09 23:30:34 +01:00
parent 600d8c184c
commit 8541bd2bd5
19 changed files with 1464 additions and 521 deletions

View File

@@ -6,7 +6,7 @@ readme = "../../README.md"
license-file = "../../LICENSE"
version = "0.1.0"
edition = "2021"
publishable = true
publish = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -15,7 +15,7 @@ anyhow.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
clap.workspace = true
dotenv.workspace = true
dotenvy.workspace = true
serde_yaml.workspace = true
serde.workspace = true
reqwest = { workspace = true, features = ["blocking", "json"] }
@@ -29,6 +29,9 @@ chrono.workspace = true
lazy_static.workspace = true
parse-changelog.workspace = true
# Cliff depends on 13.1.0, which is a broken release
cacache = "=13.0.0"
[dev-dependencies]
tracing-test = { workspace = true, features = ["no-env-filter"] }
pretty_assertions.workspace = true

View File

@@ -3,7 +3,7 @@ use chrono::{DateTime, NaiveDate, Utc};
use git_cliff_core::{
changelog::Changelog,
commit::Commit,
config::{Bump, ChangelogConfig, CommitParser, Config, GitConfig, Remote, RemoteConfig},
config::{Bump, ChangelogConfig, CommitParser, Config, GitConfig, RemoteConfig},
release::Release,
};
use regex::Regex;
@@ -79,6 +79,7 @@ impl ChangeLogBuilder {
previous: None,
message: None,
repository: None,
extra: None,
},
config: self.config,
release_link: self.release_link,
@@ -225,6 +226,8 @@ fn default_changelog_config(header: Option<String>, release_link: Option<&str>)
footer: None,
trim: Some(true),
postprocessors: None,
render_always: None,
output: None,
}
}
@@ -240,6 +243,11 @@ fn default_changelog_body_config(release_link: Option<&str>) -> String {
{% else -%}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}
{% endif -%}
{%- if commit.body -%}
{%- if commit.body | length > 0 -%}
{% raw %} {% endraw %}{{ commit.body | trim }}
{% endif -%}
{% endif -%}
{% endfor -%}
{% endfor %}"#;
@@ -512,7 +520,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#[test]
fn generates_changelog() {
let commits: Vec<&str> = vec![
"feat: some feature",
"feat: some feature
some body",
"some random commit",
"fix: some fix",
"chore(scope): some chore",
@@ -533,6 +543,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- some feature
some body
### Fixed
- some fix

View File

@@ -602,7 +602,7 @@ mod test {
let (expected, actual) = get_commits("second-sha".into()).unwrap();
assert_eq!(
expected.get(0).unwrap().clone().as_slice(),
expected.first().unwrap().clone().as_slice(),
actual.as_slice()
);
}

View File

@@ -1,5 +1,6 @@
use crate::RemoteGitEngine;
#[derive(Default)]
pub struct LocalGitClient {}
impl LocalGitClient {