diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-08-04 08:20:30 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-08-04 08:20:30 +0100 |
| commit | 6ae42e67d9da36f6c2e1356acba30a3a62112bc7 (patch) | |
| tree | 33c1ba06fc1bf79311a36693754b120ec8c67a33 /src/lib | |
| parent | a7cabb96df30cd5d26f63affdb023b0706a387d1 (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/lib')
| -rw-r--r-- | src/lib/git_events.rs | 12 |
1 files changed, 6 insertions, 6 deletions
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 | ||
| 75 | pub fn event_is_revision_root(event: &Event) -> bool { | 75 | pub 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 | ] |