upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/git_remote_nostr/push.rs32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index 9d4e9e7..48122e3 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -126,6 +126,7 @@ pub async fn run_push(
126 let (rejected_proposal_refspecs, rejected) = create_and_publish_events( 126 let (rejected_proposal_refspecs, rejected) = create_and_publish_events(
127 git_repo, 127 git_repo,
128 repo_ref, 128 repo_ref,
129 decoded_nostr_url,
129 &git_server_refspecs, 130 &git_server_refspecs,
130 &proposal_refspecs, 131 &proposal_refspecs,
131 client, 132 client,
@@ -173,9 +174,11 @@ pub async fn run_push(
173 Ok(()) 174 Ok(())
174} 175}
175 176
177#[allow(clippy::too_many_arguments)]
176async fn create_and_publish_events( 178async fn create_and_publish_events(
177 git_repo: &Repo, 179 git_repo: &Repo,
178 repo_ref: &RepoRef, 180 repo_ref: &RepoRef,
181 decoded_nostr_url: &NostrUrlDecoded,
179 git_server_refspecs: &Vec<String>, 182 git_server_refspecs: &Vec<String>,
180 proposal_refspecs: &Vec<String>, 183 proposal_refspecs: &Vec<String>,
181 client: &Client, 184 client: &Client,
@@ -216,15 +219,28 @@ async fn create_and_publish_events(
216 events.push(new_repo_state.event); 219 events.push(new_repo_state.event);
217 } 220 }
218 221
219 for event in 222 for event in get_merged_status_events(
220 get_merged_status_events(term, repo_ref, git_repo, &signer, git_server_refspecs).await? 223 term,
224 decoded_nostr_url,
225 repo_ref,
226 git_repo,
227 &signer,
228 git_server_refspecs,
229 )
230 .await?
221 { 231 {
222 events.push(event); 232 events.push(event);
223 } 233 }
224 234
225 if let Ok(Some(repo_ref_event)) = 235 if let Ok(Some(repo_ref_event)) = get_maintainers_yaml_update(
226 get_maintainers_yaml_update(term, repo_ref, git_repo, &signer, git_server_refspecs) 236 term,
227 .await 237 decoded_nostr_url,
238 repo_ref,
239 git_repo,
240 &signer,
241 git_server_refspecs,
242 )
243 .await
228 { 244 {
229 events.push(repo_ref_event); 245 events.push(repo_ref_event);
230 } 246 }
@@ -914,6 +930,7 @@ fn generate_updated_state(
914 930
915async fn get_maintainers_yaml_update( 931async fn get_maintainers_yaml_update(
916 term: &console::Term, 932 term: &console::Term,
933 decoded_nostr_url: &NostrUrlDecoded,
917 repo_ref: &RepoRef, 934 repo_ref: &RepoRef,
918 git_repo: &Repo, 935 git_repo: &Repo,
919 signer: &Arc<dyn NostrSigner>, 936 signer: &Arc<dyn NostrSigner>,
@@ -927,7 +944,7 @@ async fn get_maintainers_yaml_update(
927 git_repo.get_commit_or_tip_of_reference(&refspec_remote_ref_name( 944 git_repo.get_commit_or_tip_of_reference(&refspec_remote_ref_name(
928 &git_repo.git_repo, 945 &git_repo.git_repo,
929 refspec, 946 refspec,
930 &repo_ref.to_nostr_git_url(&Some(git_repo)), 947 &decoded_nostr_url.original_string,
931 )?)?; 948 )?)?;
932 let diff = git_repo.git_repo.diff_tree_to_tree( 949 let diff = git_repo.git_repo.diff_tree_to_tree(
933 Some( 950 Some(
@@ -982,6 +999,7 @@ async fn get_maintainers_yaml_update(
982 999
983async fn get_merged_status_events( 1000async fn get_merged_status_events(
984 term: &console::Term, 1001 term: &console::Term,
1002 decoded_nostr_url: &NostrUrlDecoded,
985 repo_ref: &RepoRef, 1003 repo_ref: &RepoRef,
986 git_repo: &Repo, 1004 git_repo: &Repo,
987 signer: &Arc<dyn NostrSigner>, 1005 signer: &Arc<dyn NostrSigner>,
@@ -996,7 +1014,7 @@ async fn get_merged_status_events(
996 git_repo.get_commit_or_tip_of_reference(&refspec_remote_ref_name( 1014 git_repo.get_commit_or_tip_of_reference(&refspec_remote_ref_name(
997 &git_repo.git_repo, 1015 &git_repo.git_repo,
998 refspec, 1016 refspec,
999 &repo_ref.to_nostr_git_url(&Some(git_repo)), 1017 &decoded_nostr_url.original_string,
1000 )?) 1018 )?)
1001 else { 1019 else {
1002 // branch not on remote 1020 // branch not on remote