1
1
mirror of https://github.com/orhun/git-cliff.git synced 2025-01-05 22:54:48 +03:00

revert(git): use timestamp for deriving the tag order (#139)

This reverts commit 4df5656c12.
This commit is contained in:
Orhun Parmaksız 2023-01-20 15:01:48 +03:00
parent 4df5656c12
commit accfb0fcdd
No known key found for this signature in database
GPG Key ID: F83424824B3E4B90

View File

@ -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<Oid> = 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()