From 3adcb4b8c8aaaf9d3947a2dc61defacc191d7403 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Thu, 3 Jun 2021 17:47:39 +0200 Subject: [PATCH] turning time slow sorted revlog off again --- asyncgit/src/sync/logwalker.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/asyncgit/src/sync/logwalker.rs b/asyncgit/src/sync/logwalker.rs index 870c8d63..c23ec2db 100644 --- a/asyncgit/src/sync/logwalker.rs +++ b/asyncgit/src/sync/logwalker.rs @@ -1,6 +1,6 @@ use super::CommitId; use crate::error::Result; -use git2::{Repository, Revwalk, Sort}; +use git2::{Repository, Revwalk}; /// pub enum Mode { @@ -43,14 +43,14 @@ impl<'a> LogWalker<'a> { if self.revwalk.is_none() { let mut walk = self.repo.revwalk()?; + // note: setting a sorting sifnificantly slows down big revwalks + if matches!(self.mode, Mode::HeadOnly) { walk.push_head()?; } else { walk.push_glob("*")?; } - walk.set_sorting(Sort::TIME)?; - self.revwalk = Some(walk); } @@ -185,11 +185,11 @@ mod tests { ); let items = walk_all_commits(&repo); - assert_eq!(items, vec![c3, c2, c1]); + assert_eq!(items, vec![c2, c3, c1]); checkout_branch(&repo_path, &b1).unwrap(); let items = walk_all_commits(&repo); - assert_eq!(items, vec![c3, c2, c1]); + assert_eq!(items, vec![c2, c3, c1]); } }