From 928d2fa8e94d961878ca22cc62052a3302027829 Mon Sep 17 00:00:00 2001 From: edef Date: Mon, 20 Jun 2022 10:28:50 +0000 Subject: fleet/pkgs/naut: filter down to commits touching the ripple subtree This is a bit crude, and it'll behave incorrectly on orphan branches, but it'll do the trick for now. Change-Id: Id5424dc4e8480ba65a029ffe2100de0c975e14a1 --- fleet/pkgs/naut/src/main.rs | 46 +++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'fleet') diff --git a/fleet/pkgs/naut/src/main.rs b/fleet/pkgs/naut/src/main.rs index 6b2550c..361c212 100644 --- a/fleet/pkgs/naut/src/main.rs +++ b/fleet/pkgs/naut/src/main.rs @@ -141,26 +141,40 @@ async fn handle( let commits: Vec<_> = walker .map(|x| repo.find_commit(x.unwrap()).unwrap()) + .filter(|c| { + // TODO(edef): we need a saner model here + // history that doesn't descend from the monorepo root shouldn't make it here at all + c.parents() + .next() + .map(|parent| { + let t1 = parent.tree().unwrap().get_name("ripple").map(|e| e.id()); + let t2 = c.tree().unwrap().get_name("ripple").map(|e| e.id()); + t1 != t2 + }) + .unwrap_or_default() + }) .collect(); - lines.push(format!( - "{} {} pushed to {}", - commits.len(), - if commits.len() == 1 { - "commit" - } else { - "commits" - }, - ref_name - )); - - for commit in commits { + if !commits.is_empty() { lines.push(format!( - " {} \"{}\" by {}", - commit.as_object().short_id()?.as_str().unwrap(), - commit.summary().unwrap(), - commit.author().name().unwrap() + "{} {} pushed to {}", + commits.len(), + if commits.len() == 1 { + "commit" + } else { + "commits" + }, + ref_name )); + + for commit in commits { + lines.push(format!( + " {} \"{}\" by {}", + commit.as_object().short_id()?.as_str().unwrap(), + commit.summary().unwrap(), + commit.author().name().unwrap() + )); + } } } } else if r#ref.is_tag() { -- cgit 1.4.1