aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/state.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/state.rs b/src/state.rs
index 9a2488b..7c33086 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -42,7 +42,14 @@ fn find_repos_in(dir: impl AsRef<Path>) -> Result<Vec<Repository>> {
impl State {
pub async fn discover(root: impl AsRef<Path>) -> Result<Self> {
let root = root.as_ref();
- let data = find_repos_in(root)?;
+ 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()
+ });
Ok(Self { root: root.to_owned(), data })
}