diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-13 16:28:33 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-13 16:28:33 +0100 |
| commit | 39bd66ed80d8d0e32e7231f1881b789392f5dacc (patch) | |
| tree | 523af0d63ffcef039a6bc61314d8585c551e5149 /src/bin/ngit/sub_commands/pull.rs | |
| parent | 97743676edd19d31807574b03b2498e7ed786a63 (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/pull.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/pull.rs | 7 |
1 files changed, 3 insertions, 4 deletions
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<()> { | |||
| 50 | .iter() | 50 | .iter() |
| 51 | .find(|e| { | 51 | .find(|e| { |
| 52 | event_to_cover_letter(e).is_ok_and(|cl| { | 52 | event_to_cover_letter(e).is_ok_and(|cl| { |
| 53 | cl.branch_name.eq(&branch_name) | 53 | (public_key_if_known.is_some_and(|public_key| e.author().eq(&public_key)) |
| 54 | || (public_key_if_known | 54 | && (branch_name.eq(&format!("pr/{}", cl.branch_name)) |
| 55 | .is_some_and(|public_key| e.author().eq(&public_key)) | 55 | || cl.branch_name.eq(&branch_name))) |
| 56 | && branch_name.eq(&format!("pr/{}", cl.branch_name))) | ||
| 57 | || cl.get_branch_name().is_ok_and(|s| s.eq(&branch_name)) | 56 | || cl.get_branch_name().is_ok_and(|s| s.eq(&branch_name)) |
| 58 | }) && !event_is_revision_root(e) | 57 | }) && !event_is_revision_root(e) |
| 59 | }) | 58 | }) |