Skip to content

Commit

Permalink
fix(changelog): set the previous release when using --latest (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Aug 14, 2021
1 parent f859747 commit 29db41a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions git-cliff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ pub fn run(mut args: Opt) -> Result<()> {
}
}

// Set the previous release if needed.
if args.latest {
if let Some((commit_id, version)) = tags.get_index(tags.len() - 2) {
let previous_release = Release {
commit_id: Some(commit_id.to_string()),
version: Some(version.to_string()),
..Release::default()
};
releases[0].previous = Some(Box::new(previous_release));
}
}

// Generate changelog.
let changelog = Changelog::new(releases, &config)?;
if let Some(path) = args.prepend {
Expand Down

0 comments on commit 29db41a

Please sign in to comment.