Skip to content

Commit

Permalink
fix(changelog): correctly set unreleased header
Browse files Browse the repository at this point in the history
When `--unreleased` is not a version it will not be prefixed.

Closes: #101
  • Loading branch information
hdevalke committed Jan 13, 2023
1 parent d787057 commit 7bff516
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/cmd/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ struct ChangeLogTransformer<'a> {
context_builder: ContextBuilder<'a>,
commit_parser: CommitParser,
paths: &'a [PathBuf],
changelog_command: &'a ChangelogCommand,
}

fn date_from_time(time: &Time) -> Date {
Expand All @@ -59,7 +58,6 @@ impl<'a> ChangeLogTransformer<'a> {
git: &'a GitHelper,
paths: &'a [PathBuf],
unreleased: String,
changelog_command: &'a ChangelogCommand,
) -> Result<Self, Error> {
let group_types = config
.types
Expand Down Expand Up @@ -94,7 +92,6 @@ impl<'a> ChangeLogTransformer<'a> {
commit_parser,
paths,
unreleased,
changelog_command,
})
}

Expand Down Expand Up @@ -202,11 +199,10 @@ impl<'a> ChangeLogTransformer<'a> {
}

let version = if from_rev.0 == "HEAD" {
format!(
"{}{}",
self.changelog_command.prefix, self.changelog_command.unreleased
)
.into()
match &self.unreleased.version {
Some(v) => format!("v{}", v.0).into(),
None => self.unreleased.str.as_str().into(),
}
} else {
from_rev.0.into()
};
Expand Down Expand Up @@ -306,7 +302,6 @@ impl ChangelogCommand {
&helper,
&self.paths,
self.unreleased.clone(),
self,
)?;
match helper
.find_last_version(rev)
Expand Down

0 comments on commit 7bff516

Please sign in to comment.