upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/git_remote_nostr/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/git_remote_nostr/utils.rs')
-rw-r--r--src/bin/git_remote_nostr/utils.rs23
1 files changed, 3 insertions, 20 deletions
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs
index 15a0d76..bbe7cfa 100644
--- a/src/bin/git_remote_nostr/utils.rs
+++ b/src/bin/git_remote_nostr/utils.rs
@@ -16,8 +16,8 @@ use ngit::{
16 Repo, RepoActions, 16 Repo, RepoActions,
17 }, 17 },
18 git_events::{ 18 git_events::{
19 event_is_revision_root, event_to_cover_letter, get_most_recent_patch_with_ancestors, 19 event_is_revision_root, get_most_recent_patch_with_ancestors,
20 status_kinds, 20 is_event_proposal_root_for_branch, status_kinds,
21 }, 21 },
22 repo_ref::RepoRef, 22 repo_ref::RepoRef,
23}; 23};
@@ -189,24 +189,7 @@ pub fn find_proposal_and_patches_by_branch_name<'a>(
189 current_user: &Option<PublicKey>, 189 current_user: &Option<PublicKey>,
190) -> Option<(&'a EventId, &'a (Event, Vec<Event>))> { 190) -> Option<(&'a EventId, &'a (Event, Vec<Event>))> {
191 open_proposals.iter().find(|(_, (proposal, _))| { 191 open_proposals.iter().find(|(_, (proposal, _))| {
192 if let Ok(cl) = event_to_cover_letter(proposal) { 192 is_event_proposal_root_for_branch(proposal, refstr, current_user).unwrap_or(false)
193 if let Ok(mut branch_name) = cl.get_branch_name() {
194 branch_name = if let Some(public_key) = current_user {
195 if proposal.author().eq(public_key) {
196 cl.branch_name.to_string()
197 } else {
198 branch_name
199 }
200 } else {
201 branch_name
202 };
203 branch_name.eq(&refstr.replace("refs/heads/", ""))
204 } else {
205 false
206 }
207 } else {
208 false
209 }
210 }) 193 })
211} 194}
212 195