diff options
author | edef <edef@unfathomable.blue> | 2022-06-20 10:28:50 +0000 |
---|---|---|
committer | edef <edef@unfathomable.blue> | 2022-06-20 11:08:34 +0000 |
commit | 928d2fa8e94d961878ca22cc62052a3302027829 (patch) | |
tree | b73ea55d9a84befd6de56e9df89b70e9d6eb5381 | |
parent | 371541b4c480ba2400cf6b5a3ef380eee9cc48bb (diff) | |
download | unf-legacy-928d2fa8e94d961878ca22cc62052a3302027829.tar.zst |
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
-rw-r--r-- | fleet/pkgs/naut/src/main.rs | 46 |
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() { |