upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bin/ngit/sub_commands/push.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-09-13 16:28:33 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-09-13 16:28:33 +0100
commit39bd66ed80d8d0e32e7231f1881b789392f5dacc (patch)
tree523af0d63ffcef039a6bc61314d8585c551e5149 /src/bin/ngit/sub_commands/push.rs
parent97743676edd19d31807574b03b2498e7ed786a63 (diff)
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.
Diffstat (limited to 'src/bin/ngit/sub_commands/push.rs')
-rw-r--r--src/bin/ngit/sub_commands/push.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/bin/ngit/sub_commands/push.rs b/src/bin/ngit/sub_commands/push.rs
index 3ec6ff9..7cdc655 100644
--- a/src/bin/ngit/sub_commands/push.rs
+++ b/src/bin/ngit/sub_commands/push.rs
@@ -66,10 +66,9 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
66 .iter() 66 .iter()
67 .find(|e| { 67 .find(|e| {
68 event_to_cover_letter(e).is_ok_and(|cl| { 68 event_to_cover_letter(e).is_ok_and(|cl| {
69 cl.branch_name.eq(&branch_name) 69 (public_key_if_known.is_some_and(|public_key| e.author().eq(&public_key))
70 || (public_key_if_known 70 && (branch_name.eq(&format!("pr/{}", cl.branch_name))
71 .is_some_and(|public_key| e.author().eq(&public_key)) 71 || cl.branch_name.eq(&branch_name)))
72 && branch_name.eq(&format!("pr/{}", cl.branch_name)))
73 || cl.get_branch_name().is_ok_and(|s| s.eq(&branch_name)) 72 || cl.get_branch_name().is_ok_and(|s| s.eq(&branch_name))
74 }) && !event_is_revision_root(e) 73 }) && !event_is_revision_root(e)
75 }) 74 })