Skip to content

Commit

Permalink
revert(git): use timestamp for deriving the tag order (#139)
Browse files Browse the repository at this point in the history
This reverts commit 4df5656.
  • Loading branch information
orhun committed Jan 20, 2023
1 parent 4df5656 commit accfb0f
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions git-cliff-core/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::error::{
use git2::{
Commit,
DescribeOptions,
Oid,
Repository as GitRepository,
Sort,
};
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit accfb0f

Please sign in to comment.