aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/state.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/state.rs b/src/state.rs
index 7c33086..004d3e2 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -44,12 +44,16 @@ impl State {
let root = root.as_ref();
let mut data = find_repos_in(root)?;
data.sort_by_key(|repo| {
- let mut revwalk = repo.revwalk().expect("revwalk failed?");
- revwalk.set_sorting(git2::Sort::TIME).expect("bruh");
- revwalk
- .map(|commit| repo.find_commit(commit.expect("yeet")).expect("sdfji").time())
- .max()
+ let mut last_update = git2::Time::new(0, 0);
+ repo.odb().expect("no object database").foreach(|oid| {
+ if let Ok(commit) = repo.find_commit(oid.clone()) {
+ last_update = last_update.max(commit.time());
+ }
+ true
+ }).expect("foreach failed");
+ last_update
});
+ data.reverse();
Ok(Self { root: root.to_owned(), data })
}