upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/git_remote_nostr/push.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/git_remote_nostr/push.rs')
-rw-r--r--src/bin/git_remote_nostr/push.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index b9e8571..61f4f92 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -66,7 +66,7 @@ pub async fn run_push(
66 .cloned() 66 .cloned()
67 .collect::<Vec<String>>(); 67 .collect::<Vec<String>>();
68 68
69 let mut git_server_refspecs = refspecs 69 let mut git_state_refspecs = refspecs
70 .iter() 70 .iter()
71 .filter(|r| !r.contains("refs/heads/pr/")) 71 .filter(|r| !r.contains("refs/heads/pr/"))
72 .cloned() 72 .cloned()
@@ -106,12 +106,12 @@ pub async fn run_push(
106 let (rejected_refspecs, remote_refspecs) = create_rejected_refspecs_and_remotes_refspecs( 106 let (rejected_refspecs, remote_refspecs) = create_rejected_refspecs_and_remotes_refspecs(
107 &term, 107 &term,
108 git_repo, 108 git_repo,
109 &git_server_refspecs, 109 &git_state_refspecs,
110 &existing_state, 110 &existing_state,
111 &list_outputs, 111 &list_outputs,
112 )?; 112 )?;
113 113
114 git_server_refspecs.retain(|refspec| { 114 git_state_refspecs.retain(|refspec| {
115 if let Some(rejected) = rejected_refspecs.get(&refspec.to_string()) { 115 if let Some(rejected) = rejected_refspecs.get(&refspec.to_string()) {
116 let (_, to) = refspec_to_from_to(refspec).unwrap(); 116 let (_, to) = refspec_to_from_to(refspec).unwrap();
117 println!("error {to} {} out of sync with nostr", rejected.join(" ")); 117 println!("error {to} {} out of sync with nostr", rejected.join(" "));
@@ -122,11 +122,11 @@ pub async fn run_push(
122 }); 122 });
123 123
124 // all refspecs aren't rejected 124 // all refspecs aren't rejected
125 if !(git_server_refspecs.is_empty() && proposal_refspecs.is_empty()) { 125 if !(git_state_refspecs.is_empty() && proposal_refspecs.is_empty()) {
126 let (rejected_proposal_refspecs, rejected) = create_and_publish_events( 126 let (rejected_proposal_refspecs, rejected) = create_and_publish_events_and_proposals(
127 git_repo, 127 git_repo,
128 repo_ref, 128 repo_ref,
129 &git_server_refspecs, 129 &git_state_refspecs,
130 &proposal_refspecs, 130 &proposal_refspecs,
131 client, 131 client,
132 existing_state, 132 existing_state,
@@ -135,7 +135,7 @@ pub async fn run_push(
135 .await?; 135 .await?;
136 136
137 if !rejected { 137 if !rejected {
138 for refspec in git_server_refspecs.iter().chain(proposal_refspecs.iter()) { 138 for refspec in git_state_refspecs.iter().chain(proposal_refspecs.iter()) {
139 if rejected_proposal_refspecs.contains(refspec) { 139 if rejected_proposal_refspecs.contains(refspec) {
140 continue; 140 continue;
141 } 141 }
@@ -154,7 +154,7 @@ pub async fn run_push(
154 for (git_server_url, remote_refspecs) in remote_refspecs { 154 for (git_server_url, remote_refspecs) in remote_refspecs {
155 let remote_refspecs = remote_refspecs 155 let remote_refspecs = remote_refspecs
156 .iter() 156 .iter()
157 .filter(|refspec| git_server_refspecs.contains(refspec)) 157 .filter(|refspec| git_state_refspecs.contains(refspec))
158 .cloned() 158 .cloned()
159 .collect::<Vec<String>>(); 159 .collect::<Vec<String>>();
160 if !refspecs.is_empty() { 160 if !refspecs.is_empty() {
@@ -175,7 +175,7 @@ pub async fn run_push(
175 Ok(()) 175 Ok(())
176} 176}
177 177
178async fn create_and_publish_events( 178async fn create_and_publish_events_and_proposals(
179 git_repo: &Repo, 179 git_repo: &Repo,
180 repo_ref: &RepoRef, 180 repo_ref: &RepoRef,
181 git_server_refspecs: &Vec<String>, 181 git_server_refspecs: &Vec<String>,