From 095525c2e0f088fa85ef514dd37701f12edcbec6 Mon Sep 17 00:00:00 2001 From: Taylan Dogan Date: Mon, 20 Sep 2021 01:11:33 +0300 Subject: [PATCH] refactor(changelog): sort commits by newest in CHANGELOG Previously, cliff was sorting the commits by oldest first. Like: ``` - Support parsing the missing scopes with `default_scope` (#8) - Support generating a changelog scoped to a directory (#11) ``` As the PR numbers indicate, the first bullet point is definitely older than the latter. With this update, it will look like this: ``` - Support generating a changelog scoped to a directory (#11) - Support parsing the missing scopes with `default_scope` (#8) ``` Signed-off-by: Taylan Dogan --- git-cliff/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-cliff/src/lib.rs b/git-cliff/src/lib.rs index 0a17e800e3..e9ebdd5637 100644 --- a/git-cliff/src/lib.rs +++ b/git-cliff/src/lib.rs @@ -145,7 +145,7 @@ pub fn run(mut args: Opt) -> Result<()> { for git_commit in commits.into_iter().rev() { let commit = Commit::from(&git_commit); let commit_id = commit.id.to_string(); - releases[release_index].commits.push(commit); + releases[release_index].commits.insert(0, commit); if let Some(tag) = tags.get(&commit_id) { releases[release_index].version = Some(tag.to_string()); releases[release_index].commit_id = Some(commit_id);