upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-06-13 09:26:37 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-06-13 09:26:37 +0100
commit65330e734ebc33ab09baff744fe77d2324b56043 (patch)
tree0bac2b0fbb12e774ab7ebfa41b476e0d539ce1a8
parentf1b3fcc40ab666d8def97096d1942c274da9b279 (diff)
feat(init): add euc marker to commit reference
based on nip34 update. see nip repository commit 8fe6e062254b37f77540088cccff60fa8615751
-rw-r--r--src/repo_ref.rs5
-rw-r--r--tests/init.rs5
2 files changed, 7 insertions, 3 deletions
diff --git a/src/repo_ref.rs b/src/repo_ref.rs
index 9fb1f0c..7016257 100644
--- a/src/repo_ref.rs
+++ b/src/repo_ref.rs
@@ -117,7 +117,10 @@ impl RepoRef {
117 } else { 117 } else {
118 self.identifier.to_string() 118 self.identifier.to_string()
119 }), 119 }),
120 Tag::from_standardized(TagStandard::Reference(self.root_commit.to_string())), 120 Tag::custom(
121 nostr::TagKind::Custom(std::borrow::Cow::Borrowed("r")),
122 vec![self.root_commit.to_string(), "euc".to_string()],
123 ),
121 Tag::from_standardized(TagStandard::Name(self.name.clone())), 124 Tag::from_standardized(TagStandard::Name(self.name.clone())),
122 Tag::from_standardized(TagStandard::Description(self.description.clone())), 125 Tag::from_standardized(TagStandard::Description(self.description.clone())),
123 Tag::custom( 126 Tag::custom(
diff --git a/tests/init.rs b/tests/init.rs
index 43d5637..40b5a45 100644
--- a/tests/init.rs
+++ b/tests/init.rs
@@ -300,7 +300,7 @@ mod when_repo_not_previously_claimed {
300 300
301 #[tokio::test] 301 #[tokio::test]
302 #[serial] 302 #[serial]
303 async fn earliest_unique_commit_as_reference() -> Result<()> { 303 async fn earliest_unique_commit_as_reference_with_euc_marker() -> Result<()> {
304 let (_, _, r53, r55, r56, r57) = prep_run_init().await?; 304 let (_, _, r53, r55, r56, r57) = prep_run_init().await?;
305 for relay in [&r53, &r55, &r56, &r57] { 305 for relay in [&r53, &r55, &r56, &r57] {
306 let event: &nostr::Event = relay 306 let event: &nostr::Event = relay
@@ -310,7 +310,8 @@ mod when_repo_not_previously_claimed {
310 .unwrap(); 310 .unwrap();
311 311
312 assert!(event.tags.iter().any(|t| t.as_vec()[0].eq("r") 312 assert!(event.tags.iter().any(|t| t.as_vec()[0].eq("r")
313 && t.as_vec()[1].eq("9ee507fc4357d7ee16a5d8901bedcd103f23c17d"))); 313 && t.as_vec()[1].eq("9ee507fc4357d7ee16a5d8901bedcd103f23c17d")
314 && t.as_vec()[2].eq("euc")));
314 } 315 }
315 Ok(()) 316 Ok(())
316 } 317 }