upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/sub_commands/push.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sub_commands/push.rs')
-rw-r--r--src/sub_commands/push.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/sub_commands/push.rs b/src/sub_commands/push.rs
index e592cd7..fac746f 100644
--- a/src/sub_commands/push.rs
+++ b/src/sub_commands/push.rs
@@ -102,8 +102,16 @@ pub async fn launch(cli_args: &Cli) -> Result<()> {
102 let mut patch_events: Vec<nostr::Event> = vec![]; 102 let mut patch_events: Vec<nostr::Event> = vec![];
103 for commit in &ahead { 103 for commit in &ahead {
104 patch_events.push( 104 patch_events.push(
105 generate_patch_event(&git_repo, &root_commit, commit, pr_event.id, &keys) 105 generate_patch_event(
106 .context("cannot make patch event from commit")?, 106 &git_repo,
107 &root_commit,
108 commit,
109 pr_event.id,
110 &keys,
111 &repo_ref,
112 patch_events.last().map(nostr::Event::id),
113 )
114 .context("cannot make patch event from commit")?,
107 ); 115 );
108 } 116 }
109 println!("pushing {} commits", ahead.len()); 117 println!("pushing {} commits", ahead.len());
@@ -162,8 +170,7 @@ async fn fetch_pr_and_most_recent_patch_chain(
162 vec![ 170 vec![
163 nostr::Filter::default() 171 nostr::Filter::default()
164 .kind(nostr::Kind::Custom(PATCH_KIND)) 172 .kind(nostr::Kind::Custom(PATCH_KIND))
165 .event(pr_event.id) 173 .event(pr_event.id),
166 .reference(format!("r-{root_commit}")),
167 ], 174 ],
168 ) 175 )
169 .await? 176 .await?
@@ -173,9 +180,6 @@ async fn fetch_pr_and_most_recent_patch_chain(
173 && e.tags 180 && e.tags
174 .iter() 181 .iter()
175 .any(|t| t.as_vec().len() > 2 && t.as_vec()[1].eq(&pr_event.id.to_string())) 182 .any(|t| t.as_vec().len() > 2 && t.as_vec()[1].eq(&pr_event.id.to_string()))
176 && e.tags
177 .iter()
178 .any(|t| t.as_vec().len() > 1 && t.as_vec()[1].eq(&format!("r-{root_commit}")))
179 }) 183 })
180 .map(std::borrow::ToOwned::to_owned) 184 .map(std::borrow::ToOwned::to_owned)
181 .collect(); 185 .collect();