From accfb0fcdd06c66d3e9d98f8848cbb9ab0944d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Fri, 20 Jan 2023 15:01:48 +0300 Subject: [PATCH] revert(git): use timestamp for deriving the tag order (#139) This reverts commit 4df5656c1239b0252ce9e7571efa06e9d11490ea. --- git-cliff-core/src/repo.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/git-cliff-core/src/repo.rs b/git-cliff-core/src/repo.rs index 40f07f7b..54824b08 100644 --- a/git-cliff-core/src/repo.rs +++ b/git-cliff-core/src/repo.rs @@ -5,7 +5,6 @@ use crate::error::{ use git2::{ Commit, DescribeOptions, - Oid, Repository as GitRepository, Sort, }; @@ -123,15 +122,7 @@ impl Repository { } } if !topo_order { - let mut revwalk = self.inner.revwalk()?; - revwalk.set_sorting(Sort::TIME | Sort::TOPOLOGICAL)?; - revwalk.push_head()?; - let oids: Vec = revwalk.filter_map(|id| id.ok()).collect(); - tags.sort_by(|a, b| { - oids.iter() - .position(|v| v == &b.0.id()) - .cmp(&oids.iter().position(|v| v == &a.0.id())) - }); + tags.sort_by(|a, b| a.0.time().seconds().cmp(&b.0.time().seconds())); } Ok(tags .into_iter()