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.rs25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs
index dc75872..d0b4e7e 100644
--- a/src/bin/git_remote_nostr/utils.rs
+++ b/src/bin/git_remote_nostr/utils.rs
@@ -10,7 +10,7 @@ use anyhow::{Context, Result, bail};
10use git2::Repository; 10use git2::Repository;
11use ngit::{ 11use ngit::{
12 client::{ 12 client::{
13 get_all_proposal_patch_events_from_cache, get_events_from_local_cache, 13 get_all_proposal_patch_pr_pr_update_events_from_cache, get_events_from_local_cache,
14 get_proposals_and_revisions_from_cache, 14 get_proposals_and_revisions_from_cache,
15 }, 15 },
16 git::{ 16 git::{
@@ -18,7 +18,7 @@ use ngit::{
18 nostr_url::{CloneUrl, NostrUrlDecoded, ServerProtocol}, 18 nostr_url::{CloneUrl, NostrUrlDecoded, ServerProtocol},
19 }, 19 },
20 git_events::{ 20 git_events::{
21 event_is_revision_root, get_most_recent_patch_with_ancestors, 21 event_is_revision_root, get_pr_tip_event_or_most_recent_patch_with_ancestors,
22 is_event_proposal_root_for_branch, status_kinds, 22 is_event_proposal_root_for_branch, status_kinds,
23 }, 23 },
24 repo_ref::RepoRef, 24 repo_ref::RepoRef,
@@ -140,12 +140,15 @@ pub async fn get_open_or_draft_proposals(
140 Kind::GitStatusOpen 140 Kind::GitStatusOpen
141 }; 141 };
142 if [Kind::GitStatusOpen, Kind::GitStatusDraft].contains(&status) { 142 if [Kind::GitStatusOpen, Kind::GitStatusDraft].contains(&status) {
143 if let Ok(commits_events) = 143 if let Ok(commits_events) = get_all_proposal_patch_pr_pr_update_events_from_cache(
144 get_all_proposal_patch_events_from_cache(git_repo_path, repo_ref, &proposal.id) 144 git_repo_path,
145 .await 145 repo_ref,
146 &proposal.id,
147 )
148 .await
146 { 149 {
147 if let Ok(most_recent_proposal_patch_chain) = 150 if let Ok(most_recent_proposal_patch_chain) =
148 get_most_recent_patch_with_ancestors(commits_events.clone()) 151 get_pr_tip_event_or_most_recent_patch_with_ancestors(commits_events.clone())
149 { 152 {
150 open_or_draft_proposals 153 open_or_draft_proposals
151 .insert(proposal.id, (proposal, most_recent_proposal_patch_chain)); 154 .insert(proposal.id, (proposal, most_recent_proposal_patch_chain));
@@ -172,11 +175,15 @@ pub async fn get_all_proposals(
172 let mut all_proposals = HashMap::new(); 175 let mut all_proposals = HashMap::new();
173 176
174 for proposal in proposals { 177 for proposal in proposals {
175 if let Ok(commits_events) = 178 if let Ok(commits_events) = get_all_proposal_patch_pr_pr_update_events_from_cache(
176 get_all_proposal_patch_events_from_cache(git_repo_path, repo_ref, &proposal.id).await 179 git_repo_path,
180 repo_ref,
181 &proposal.id,
182 )
183 .await
177 { 184 {
178 if let Ok(most_recent_proposal_patch_chain) = 185 if let Ok(most_recent_proposal_patch_chain) =
179 get_most_recent_patch_with_ancestors(commits_events.clone()) 186 get_pr_tip_event_or_most_recent_patch_with_ancestors(commits_events.clone())
180 { 187 {
181 all_proposals.insert(proposal.id, (proposal, most_recent_proposal_patch_chain)); 188 all_proposals.insert(proposal.id, (proposal, most_recent_proposal_patch_chain));
182 } 189 }