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:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-07-25 12:23:23 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-07-25 16:10:58 +0100
commit4fc659074ec5ced3cc0727cf1f3e6af082a189cc (patch)
tree5fa377a4d5b6ccd988862697730b8527ef8c2014 /src/bin/git_remote_nostr/push.rs
parent9357b62b9824299be6fc85b09f57d93d3902f79a (diff)
feat(pr): add pr and pr update merge support
as these events use `c` instead of `commit`
Diffstat (limited to 'src/bin/git_remote_nostr/push.rs')
-rw-r--r--src/bin/git_remote_nostr/push.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index 353ad77..909a0ab 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -1246,7 +1246,7 @@ type MergedProposalsInfo =
1246async fn get_merged_proposals_info( 1246async fn get_merged_proposals_info(
1247 git_repo: &Repo, 1247 git_repo: &Repo,
1248 ahead: &Vec<Sha1Hash>, 1248 ahead: &Vec<Sha1Hash>,
1249 available_patches: &[Event], 1249 available_patches_pr_pr_update: &[Event],
1250) -> Result<MergedProposalsInfo> { 1250) -> Result<MergedProposalsInfo> {
1251 let mut proposals: MergedProposalsInfo = HashMap::new(); 1251 let mut proposals: MergedProposalsInfo = HashMap::new();
1252 1252
@@ -1256,19 +1256,19 @@ async fn get_merged_proposals_info(
1256 // are in ahead 1256 // are in ahead
1257 if commit.parent_count() > 1 { 1257 if commit.parent_count() > 1 {
1258 for parent in commit.parents() { 1258 for parent in commit.parents() {
1259 for patch_event in available_patches 1259 for event in available_patches_pr_pr_update
1260 .iter() 1260 .iter()
1261 .filter(|e| { 1261 .filter(|e| {
1262 e.tags.iter().any(|t| { 1262 e.tags.iter().any(|t| {
1263 t.as_slice().len() > 1 1263 t.as_slice().len() > 1
1264 && t.as_slice()[0].eq("commit") 1264 && (t.as_slice()[0].eq("commit") || t.as_slice()[0].eq("c"))
1265 && t.as_slice()[1].eq(&parent.id().to_string()) 1265 && t.as_slice()[1].eq(&parent.id().to_string())
1266 }) 1266 })
1267 }) 1267 })
1268 .collect::<Vec<&Event>>() 1268 .collect::<Vec<&Event>>()
1269 { 1269 {
1270 if let Ok((proposal_id, revision_id)) = 1270 if let Ok((proposal_id, revision_id)) =
1271 get_proposal_and_revision_root_from_patch(git_repo, patch_event).await 1271 get_proposal_and_revision_root_from_patch(git_repo, event).await
1272 { 1272 {
1273 let (entry_revision_id, merged_patches) = 1273 let (entry_revision_id, merged_patches) =
1274 proposals.entry(proposal_id).or_default(); 1274 proposals.entry(proposal_id).or_default();
@@ -1281,12 +1281,12 @@ async fn get_merged_proposals_info(
1281 } else { 1281 } else {
1282 // three way merge or fast forward merge commits 1282 // three way merge or fast forward merge commits
1283 // note: ahead included commits of three-way merged branches 1283 // note: ahead included commits of three-way merged branches
1284 let mut matching_patches = available_patches 1284 let mut matching_patches = available_patches_pr_pr_update
1285 .iter() 1285 .iter()
1286 .filter(|e| { 1286 .filter(|e| {
1287 e.tags.iter().any(|t| { 1287 e.tags.iter().any(|t| {
1288 t.as_slice().len() > 1 1288 t.as_slice().len() > 1
1289 && t.as_slice()[0].eq("commit") 1289 && (t.as_slice()[0].eq("commit") || t.as_slice()[0].eq("c"))
1290 && t.as_slice()[1].eq(&commit_hash.to_string()) 1290 && t.as_slice()[1].eq(&commit_hash.to_string())
1291 }) 1291 })
1292 }) 1292 })
@@ -1311,7 +1311,7 @@ async fn get_merged_proposals_info(
1311 // applied commits - this is done after so that merged revisions take priority 1311 // applied commits - this is done after so that merged revisions take priority
1312 if matching_patches.is_empty() { 1312 if matching_patches.is_empty() {
1313 let author = git_repo.get_commit_author(commit_hash)?; 1313 let author = git_repo.get_commit_author(commit_hash)?;
1314 matching_patches = available_patches 1314 matching_patches = available_patches_pr_pr_update
1315 .iter() 1315 .iter()
1316 .filter(|e| { 1316 .filter(|e| {
1317 if let Ok(patch_author) = get_patch_author(e) { 1317 if let Ok(patch_author) = get_patch_author(e) {