summary refs log tree commit diff
path: root/fleet
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-06-20 10:28:50 +0000
committeredef <edef@unfathomable.blue>2022-06-20 11:08:34 +0000
commit928d2fa8e94d961878ca22cc62052a3302027829 (patch)
treeb73ea55d9a84befd6de56e9df89b70e9d6eb5381 /fleet
parent371541b4c480ba2400cf6b5a3ef380eee9cc48bb (diff)
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
Diffstat (limited to 'fleet')
-rw-r--r--fleet/pkgs/naut/src/main.rs46
1 files changed, 30 insertions, 16 deletions
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() {