Skip to content

Commit

Permalink
fix(log): remove redundant logging while using --context (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Mar 27, 2022
1 parent f48d207 commit efd40e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
10 changes: 1 addition & 9 deletions git-cliff/src/changelog.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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()
Expand Down
12 changes: 7 additions & 5 deletions git-cliff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit efd40e0

Please sign in to comment.