1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-11-25 10:42:43 +03:00

fix(log): remove redundant logging while using --context (#71)

This commit is contained in:
Orhun Parmaksız 2022-03-27 19:46:44 +03:00
parent f48d2077c3
commit efd40e02b3
No known key found for this signature in database
GPG Key ID: B928720AEC532117
2 changed files with 8 additions and 14 deletions

View File

@ -1,9 +1,6 @@
use git_cliff_core::commit::Commit;
use git_cliff_core::config::Config;
use git_cliff_core::error::{
Error,
Result,
};
use git_cliff_core::error::Result;
use git_cliff_core::release::{
Release,
Releases,
@ -28,11 +25,6 @@ impl<'a> Changelog<'a> {
.as_deref()
.unwrap_or_default()
.to_string();
if template.is_empty() {
return Err(Error::ChangelogError(String::from(
"changelog body cannot be empty",
)));
}
if config.changelog.trim.unwrap_or(true) {
template = template
.lines()

View File

@ -83,13 +83,15 @@ pub fn run(mut args: Opt) -> Result<()> {
let mut config = if path.exists() {
Config::parse(&path)?
} else {
warn!(
"{:?} is not found, using the default configuration.",
args.config
);
if !args.context {
warn!(
"{:?} is not found, using the default configuration.",
args.config
);
}
EmbeddedConfig::parse()?
};
if config.changelog.body.is_none() {
if config.changelog.body.is_none() && !args.context {
warn!("Changelog body is not specified, using the default template.");
config.changelog.body = EmbeddedConfig::parse()?.changelog.body;
}