upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-08-04 08:20:30 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-08-04 08:20:30 +0100
commit6ae42e67d9da36f6c2e1356acba30a3a62112bc7 (patch)
tree33c1ba06fc1bf79311a36693754b120ec8c67a33 /src
parenta7cabb96df30cd5d26f63affdb023b0706a387d1 (diff)
fix: `t` tag `revision-root` ~> `root-revision`
NIP-34 specifies patch revisions should have a `t` tag of `root-revision` whereas we have been using `revision-root`. this fixes it and and handles events created with the incorrect tag.
Diffstat (limited to 'src')
-rw-r--r--src/bin/git_remote_nostr/push.rs9
-rw-r--r--src/lib/git_events.rs12
2 files changed, 10 insertions, 11 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index 9ba7c30..d0cf923 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -1365,11 +1365,10 @@ async fn get_proposal_and_revision_root_from_patch(
1365 bail!("thread root is not a git patch"); 1365 bail!("thread root is not a git patch");
1366 } 1366 }
1367 1367
1368 if proposal_or_revision 1368 if proposal_or_revision.tags.iter().any(|t| {
1369 .tags 1369 t.as_slice().len() > 1
1370 .iter() 1370 && ["revision-root", "root-revision"].contains(&t.as_slice()[1].as_str())
1371 .any(|t| t.as_slice().len() > 1 && t.as_slice()[1].eq("revision-root")) 1371 }) {
1372 {
1373 Ok(( 1372 Ok((
1374 EventId::parse( 1373 EventId::parse(
1375 &proposal_or_revision 1374 &proposal_or_revision
diff --git a/src/lib/git_events.rs b/src/lib/git_events.rs
index 79f5772..8ba5419 100644
--- a/src/lib/git_events.rs
+++ b/src/lib/git_events.rs
@@ -74,10 +74,10 @@ pub fn event_is_patch_set_root(event: &Event) -> bool {
74 74
75pub fn event_is_revision_root(event: &Event) -> bool { 75pub fn event_is_revision_root(event: &Event) -> bool {
76 (event.kind.eq(&Kind::GitPatch) 76 (event.kind.eq(&Kind::GitPatch)
77 && event 77 && event.tags.iter().any(|t| {
78 .tags 78 t.as_slice().len() > 1
79 .iter() 79 && ["revision-root", "root-revision"].contains(&t.as_slice()[1].as_str())
80 .any(|t| t.as_slice().len() > 1 && t.as_slice()[1].eq("revision-root"))) 80 }))
81 || (event.kind.eq(&KIND_PULL_REQUEST) 81 || (event.kind.eq(&KIND_PULL_REQUEST)
82 && event 82 && event
83 .tags 83 .tags
@@ -179,7 +179,7 @@ pub async fn generate_patch_event(
179 } else if let Some(event_ref) = root_proposal_id.clone() { 179 } else if let Some(event_ref) = root_proposal_id.clone() {
180 vec![ 180 vec![
181 Tag::hashtag("root"), 181 Tag::hashtag("root"),
182 Tag::hashtag("revision-root"), 182 Tag::hashtag("root-revision"),
183 // TODO check if id is for a root proposal (perhaps its for an issue?) 183 // TODO check if id is for a root proposal (perhaps its for an issue?)
184 event_tag_from_nip19_or_hex( 184 event_tag_from_nip19_or_hex(
185 &event_ref, 185 &event_ref,
@@ -598,7 +598,7 @@ pub async fn generate_cover_letter_and_patch_events(
598 if let Some(event_ref) = root_proposal_id.clone() { 598 if let Some(event_ref) = root_proposal_id.clone() {
599 vec![ 599 vec![
600 Tag::hashtag("root"), 600 Tag::hashtag("root"),
601 Tag::hashtag("revision-root"), 601 Tag::hashtag("root-revision"),
602 // TODO check if id is for a root proposal (perhaps its for an issue?) 602 // TODO check if id is for a root proposal (perhaps its for an issue?)
603 event_tag_from_nip19_or_hex(&event_ref,"proposal",EventRefType::Reply, false, false)?, 603 event_tag_from_nip19_or_hex(&event_ref,"proposal",EventRefType::Reply, false, false)?,
604 ] 604 ]