From 39bd66ed80d8d0e32e7231f1881b789392f5dacc Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 13 Sep 2024 16:28:33 +0100 Subject: fix(ngit): improve find pr from branch so that it only finds branch name not prefixed with `pr/` if you are the author of the pr as there may be duplicate named prs. --- src/bin/ngit/sub_commands/pull.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/bin/ngit/sub_commands/pull.rs') diff --git a/src/bin/ngit/sub_commands/pull.rs b/src/bin/ngit/sub_commands/pull.rs index b331dbe..eba6fc5 100644 --- a/src/bin/ngit/sub_commands/pull.rs +++ b/src/bin/ngit/sub_commands/pull.rs @@ -50,10 +50,9 @@ pub async fn launch() -> Result<()> { .iter() .find(|e| { event_to_cover_letter(e).is_ok_and(|cl| { - cl.branch_name.eq(&branch_name) - || (public_key_if_known - .is_some_and(|public_key| e.author().eq(&public_key)) - && branch_name.eq(&format!("pr/{}", cl.branch_name))) + (public_key_if_known.is_some_and(|public_key| e.author().eq(&public_key)) + && (branch_name.eq(&format!("pr/{}", cl.branch_name)) + || cl.branch_name.eq(&branch_name))) || cl.get_branch_name().is_ok_and(|s| s.eq(&branch_name)) }) && !event_is_revision_root(e) }) -- cgit v1.2.3