upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--src/bin/git_remote_nostr/push.rs39
2 files changed, 33 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bccb23f..324bcff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7 7
8## [Unreleased] 8## [Unreleased]
9 9
10### Fixed
11
12- gracefully handle errors identifying potential PR merges during push
13
10## [2.3.0] - 2026-03-05 14## [2.3.0] - 2026-03-05
11 15
12### Added 16### Added
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index 3b5e05d..1f4b3ef 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -357,7 +357,7 @@ async fn create_and_publish_events_and_proposals(
357 events.push(new_repo_state.event); 357 events.push(new_repo_state.event);
358 } 358 }
359 359
360 for event in get_merged_status_events( 360 if let Ok(merged_status_events) = get_merged_status_events(
361 term, 361 term,
362 &repo_ref.to_nostr_git_url(&None), 362 &repo_ref.to_nostr_git_url(&None),
363 repo_ref, 363 repo_ref,
@@ -365,9 +365,11 @@ async fn create_and_publish_events_and_proposals(
365 &signer, 365 &signer,
366 git_server_refspecs, 366 git_server_refspecs,
367 ) 367 )
368 .await? 368 .await
369 { 369 {
370 events.push(event); 370 for event in merged_status_events {
371 events.push(event);
372 }
371 } 373 }
372 374
373 if let Ok(Some(repo_ref_event)) = get_maintainers_yaml_update( 375 if let Ok(Some(repo_ref_event)) = get_maintainers_yaml_update(
@@ -1294,7 +1296,14 @@ async fn create_merge_events(
1294 term.write_line( 1296 term.write_line(
1295 format!( 1297 format!(
1296 "merge commit {}: create nostr proposal status event", 1298 "merge commit {}: create nostr proposal status event",
1297 &merged_patches.keys().next().unwrap().to_string()[..7], 1299 merged_patches
1300 .keys()
1301 .next()
1302 .map(|h| {
1303 let s = h.to_string();
1304 s[..s.len().min(7)].to_string()
1305 })
1306 .unwrap_or_default(),
1298 ) 1307 )
1299 .as_str(), 1308 .as_str(),
1300 )?; 1309 )?;
@@ -1527,14 +1536,19 @@ async fn get_proposal_and_revision_root_from_patch_or_pr_or_pr_update(
1527 .clone(), 1536 .clone(),
1528 )?; 1537 )?;
1529 1538
1530 get_events_from_local_cache( 1539 let cached = get_events_from_local_cache(
1531 git_repo.get_path()?, 1540 git_repo.get_path()?,
1532 vec![nostr::Filter::default().id(proposal_or_revision_id)], 1541 vec![nostr::Filter::default().id(proposal_or_revision_id)],
1533 ) 1542 )
1534 .await? 1543 .await?;
1535 .first() 1544 cached
1536 .unwrap() 1545 .first()
1537 .clone() 1546 .ok_or_else(|| {
1547 anyhow::anyhow!(
1548 "proposal or revision root event {proposal_or_revision_id} not found in local cache",
1549 )
1550 })?
1551 .clone()
1538 }; 1552 };
1539 1553
1540 if !proposal_or_revision.kind.eq(&Kind::GitPatch) { 1554 if !proposal_or_revision.kind.eq(&Kind::GitPatch) {
@@ -1551,7 +1565,12 @@ async fn get_proposal_and_revision_root_from_patch_or_pr_or_pr_update(
1551 .tags 1565 .tags
1552 .iter() 1566 .iter()
1553 .find(|t| t.is_reply()) 1567 .find(|t| t.is_reply())
1554 .unwrap() 1568 .ok_or_else(|| {
1569 anyhow::anyhow!(
1570 "revision-root patch event {} missing reply tag",
1571 proposal_or_revision.id
1572 )
1573 })?
1555 .as_slice()[1], 1574 .as_slice()[1],
1556 )?, 1575 )?,
1557 Some(proposal_or_revision.id), 1576 Some(proposal_or_revision.id),