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--Cargo.lock16
-rw-r--r--Cargo.toml10
-rw-r--r--src/lib/client.rs36
-rw-r--r--src/lib/git/mod.rs14
-rw-r--r--src/lib/repo_ref.rs4
-rw-r--r--src/lib/repo_state.rs3
-rw-r--r--test_utils/Cargo.toml8
-rw-r--r--test_utils/src/git.rs2
-rw-r--r--test_utils/src/lib.rs31
-rw-r--r--tests/git_remote_nostr/main.rs2
-rw-r--r--tests/git_remote_nostr/push.rs4
-rw-r--r--tests/ngit_list.rs2
-rw-r--r--tests/ngit_send.rs8
13 files changed, 75 insertions, 65 deletions
diff --git a/Cargo.lock b/Cargo.lock
index f5c0227..b20b60a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1843,7 +1843,7 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
1843[[package]] 1843[[package]]
1844name = "nostr" 1844name = "nostr"
1845version = "0.35.0" 1845version = "0.35.0"
1846source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" 1846source = "git+https://github.com/rust-nostr/nostr?rev=ede2a91#ede2a91ef7d3738b36a03243697fbd20efd335a1"
1847dependencies = [ 1847dependencies = [
1848 "aes", 1848 "aes",
1849 "base64", 1849 "base64",
@@ -1873,7 +1873,7 @@ dependencies = [
1873[[package]] 1873[[package]]
1874name = "nostr-database" 1874name = "nostr-database"
1875version = "0.35.0" 1875version = "0.35.0"
1876source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" 1876source = "git+https://github.com/rust-nostr/nostr?rev=ede2a91#ede2a91ef7d3738b36a03243697fbd20efd335a1"
1877dependencies = [ 1877dependencies = [
1878 "async-trait", 1878 "async-trait",
1879 "flatbuffers", 1879 "flatbuffers",
@@ -1887,7 +1887,7 @@ dependencies = [
1887[[package]] 1887[[package]]
1888name = "nostr-lmdb" 1888name = "nostr-lmdb"
1889version = "0.35.0" 1889version = "0.35.0"
1890source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" 1890source = "git+https://github.com/rust-nostr/nostr?rev=ede2a91#ede2a91ef7d3738b36a03243697fbd20efd335a1"
1891dependencies = [ 1891dependencies = [
1892 "heed", 1892 "heed",
1893 "nostr", 1893 "nostr",
@@ -1900,7 +1900,7 @@ dependencies = [
1900[[package]] 1900[[package]]
1901name = "nostr-relay-pool" 1901name = "nostr-relay-pool"
1902version = "0.35.0" 1902version = "0.35.0"
1903source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" 1903source = "git+https://github.com/rust-nostr/nostr?rev=ede2a91#ede2a91ef7d3738b36a03243697fbd20efd335a1"
1904dependencies = [ 1904dependencies = [
1905 "async-utility", 1905 "async-utility",
1906 "async-wsocket", 1906 "async-wsocket",
@@ -1918,7 +1918,7 @@ dependencies = [
1918[[package]] 1918[[package]]
1919name = "nostr-sdk" 1919name = "nostr-sdk"
1920version = "0.35.0" 1920version = "0.35.0"
1921source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" 1921source = "git+https://github.com/rust-nostr/nostr?rev=ede2a91#ede2a91ef7d3738b36a03243697fbd20efd335a1"
1922dependencies = [ 1922dependencies = [
1923 "async-utility", 1923 "async-utility",
1924 "atomic-destructor", 1924 "atomic-destructor",
@@ -1937,7 +1937,7 @@ dependencies = [
1937[[package]] 1937[[package]]
1938name = "nostr-signer" 1938name = "nostr-signer"
1939version = "0.35.0" 1939version = "0.35.0"
1940source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" 1940source = "git+https://github.com/rust-nostr/nostr?rev=ede2a91#ede2a91ef7d3738b36a03243697fbd20efd335a1"
1941dependencies = [ 1941dependencies = [
1942 "async-utility", 1942 "async-utility",
1943 "nostr", 1943 "nostr",
@@ -1950,7 +1950,7 @@ dependencies = [
1950[[package]] 1950[[package]]
1951name = "nostr-zapper" 1951name = "nostr-zapper"
1952version = "0.35.0" 1952version = "0.35.0"
1953source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" 1953source = "git+https://github.com/rust-nostr/nostr?rev=ede2a91#ede2a91ef7d3738b36a03243697fbd20efd335a1"
1954dependencies = [ 1954dependencies = [
1955 "async-trait", 1955 "async-trait",
1956 "nostr", 1956 "nostr",
@@ -2039,7 +2039,7 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
2039[[package]] 2039[[package]]
2040name = "nwc" 2040name = "nwc"
2041version = "0.35.0" 2041version = "0.35.0"
2042source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" 2042source = "git+https://github.com/rust-nostr/nostr?rev=ede2a91#ede2a91ef7d3738b36a03243697fbd20efd335a1"
2043dependencies = [ 2043dependencies = [
2044 "async-utility", 2044 "async-utility",
2045 "nostr", 2045 "nostr",
diff --git a/Cargo.toml b/Cargo.toml
index 79a9990..ed99aea 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,11 +24,11 @@ futures = "0.3.28"
24git2 = "0.19.0" 24git2 = "0.19.0"
25indicatif = "0.17.7" 25indicatif = "0.17.7"
26keyring = "2.0.5" 26keyring = "2.0.5"
27nostr = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 27nostr = { git = "https://github.com/rust-nostr/nostr", rev = "ede2a91" }
28nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 28nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "ede2a91" }
29nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 29nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "ede2a91" }
30nostr-signer = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 30nostr-signer = { git = "https://github.com/rust-nostr/nostr", rev = "ede2a91" }
31nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 31nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", rev = "ede2a91" }
32passwords = "3.1.13" 32passwords = "3.1.13"
33qrcode = { version = "0.14.1", default-features = false } 33qrcode = { version = "0.14.1", default-features = false }
34scrypt = "0.11.0" 34scrypt = "0.11.0"
diff --git a/src/lib/client.rs b/src/lib/client.rs
index 8a381ab..d9ba351 100644
--- a/src/lib/client.rs
+++ b/src/lib/client.rs
@@ -179,14 +179,14 @@ impl Connect for Client {
179 179
180 let relay = self.client.relay(relay_url).await?; 180 let relay = self.client.relay(relay_url).await?;
181 181
182 if !relay.is_connected().await { 182 if !relay.is_connected() {
183 #[allow(clippy::large_futures)] 183 #[allow(clippy::large_futures)]
184 relay 184 relay
185 .connect(Some(std::time::Duration::from_secs(CONNECTION_TIMEOUT))) 185 .connect(Some(std::time::Duration::from_secs(CONNECTION_TIMEOUT)))
186 .await; 186 .await;
187 } 187 }
188 188
189 if !relay.is_connected().await { 189 if !relay.is_connected() {
190 bail!("connection timeout"); 190 bail!("connection timeout");
191 } 191 }
192 Ok(()) 192 Ok(())
@@ -615,26 +615,27 @@ async fn get_events_of(
615) -> Result<Vec<Event>> { 615) -> Result<Vec<Event>> {
616 // relay.reconcile(filter, opts).await?; 616 // relay.reconcile(filter, opts).await?;
617 617
618 if !relay.is_connected().await { 618 if !relay.is_connected() {
619 #[allow(clippy::large_futures)] 619 #[allow(clippy::large_futures)]
620 relay 620 relay
621 .connect(Some(std::time::Duration::from_secs(CONNECTION_TIMEOUT))) 621 .connect(Some(std::time::Duration::from_secs(CONNECTION_TIMEOUT)))
622 .await; 622 .await;
623 } 623 }
624 624
625 if !relay.is_connected().await { 625 if !relay.is_connected() {
626 bail!("connection timeout"); 626 bail!("connection timeout");
627 } else if let Some(pb) = pb { 627 } else if let Some(pb) = pb {
628 pb.set_prefix(format!("connected {}", relay.url())); 628 pb.set_prefix(format!("connected {}", relay.url()));
629 } 629 }
630 let events = relay 630 let events = relay
631 .get_events_of( 631 .fetch_events(
632 filters, 632 filters,
633 // 20 is nostr_sdk default 633 // 20 is nostr_sdk default
634 std::time::Duration::from_secs(GET_EVENTS_TIMEOUT), 634 std::time::Duration::from_secs(GET_EVENTS_TIMEOUT),
635 nostr_sdk::FilterOptions::ExitOnEOSE, 635 nostr_sdk::FilterOptions::ExitOnEOSE,
636 ) 636 )
637 .await?; 637 .await?
638 .to_vec();
638 Ok(events) 639 Ok(events)
639} 640}
640 641
@@ -754,24 +755,26 @@ pub async fn get_events_from_cache(
754 git_repo_path: &Path, 755 git_repo_path: &Path,
755 filters: Vec<nostr::Filter>, 756 filters: Vec<nostr::Filter>,
756) -> Result<Vec<nostr::Event>> { 757) -> Result<Vec<nostr::Event>> {
757 get_local_cache_database(git_repo_path) 758 Ok(get_local_cache_database(git_repo_path)
758 .await? 759 .await?
759 .query(filters.clone()) 760 .query(filters.clone())
760 .await 761 .await
761 .context( 762 .context(
762 "cannot execute query on opened git repo nostr cache database .git/nostr-cache.lmdb", 763 "cannot execute query on opened git repo nostr cache database .git/nostr-cache.lmdb",
763 ) 764 )?
765 .to_vec())
764} 766}
765 767
766pub async fn get_event_from_global_cache( 768pub async fn get_event_from_global_cache(
767 git_repo_path: &Path, 769 git_repo_path: &Path,
768 filters: Vec<nostr::Filter>, 770 filters: Vec<nostr::Filter>,
769) -> Result<Vec<nostr::Event>> { 771) -> Result<Vec<nostr::Event>> {
770 get_global_cache_database(git_repo_path) 772 Ok(get_global_cache_database(git_repo_path)
771 .await? 773 .await?
772 .query(filters.clone()) 774 .query(filters.clone())
773 .await 775 .await
774 .context("cannot execute query on opened ngit nostr cache database") 776 .context("cannot execute query on opened ngit nostr cache database")?
777 .to_vec())
775} 778}
776 779
777pub async fn save_event_in_cache(git_repo_path: &Path, event: &nostr::Event) -> Result<bool> { 780pub async fn save_event_in_cache(git_repo_path: &Path, event: &nostr::Event) -> Result<bool> {
@@ -841,7 +844,7 @@ pub async fn get_repo_ref_from_cache(
841 events.insert( 844 events.insert(
842 Coordinate { 845 Coordinate {
843 kind: e.kind, 846 kind: e.kind,
844 identifier: e.identifier().unwrap().to_string(), 847 identifier: e.tags.identifier().unwrap().to_string(),
845 public_key: e.pubkey, 848 public_key: e.pubkey,
846 relays: vec![], 849 relays: vec![],
847 }, 850 },
@@ -1114,7 +1117,7 @@ async fn process_fetched_events(
1114 .iter() 1117 .iter()
1115 .map(|(c, _)| c.clone()) 1118 .map(|(c, _)| c.clone())
1116 .any(|c| { 1119 .any(|c| {
1117 c.identifier.eq(event.identifier().unwrap()) 1120 c.identifier.eq(event.tags.identifier().unwrap())
1118 && c.public_key.eq(&event.pubkey) 1121 && c.public_key.eq(&event.pubkey)
1119 }); 1122 });
1120 let update_to_existing = !new_coordinate 1123 let update_to_existing = !new_coordinate
@@ -1122,7 +1125,7 @@ async fn process_fetched_events(
1122 .repo_coordinates_without_relays 1125 .repo_coordinates_without_relays
1123 .iter() 1126 .iter()
1124 .any(|(c, t)| { 1127 .any(|(c, t)| {
1125 c.identifier.eq(event.identifier().unwrap()) 1128 c.identifier.eq(event.tags.identifier().unwrap())
1126 && c.public_key.eq(&event.pubkey) 1129 && c.public_key.eq(&event.pubkey)
1127 && if let Some(t) = t { 1130 && if let Some(t) = t {
1128 event.created_at.gt(t) 1131 event.created_at.gt(t)
@@ -1135,7 +1138,7 @@ async fn process_fetched_events(
1135 Coordinate { 1138 Coordinate {
1136 kind: event.kind, 1139 kind: event.kind,
1137 public_key: event.pubkey, 1140 public_key: event.pubkey,
1138 identifier: event.identifier().unwrap().to_owned(), 1141 identifier: event.tags.identifier().unwrap().to_owned(),
1139 relays: vec![], 1142 relays: vec![],
1140 }, 1143 },
1141 event.created_at, 1144 event.created_at,
@@ -1216,7 +1219,10 @@ async fn process_fetched_events(
1216 } 1219 }
1217 for event in &events { 1220 for event in &events {
1218 if !request.existing_events.contains(&event.id) 1221 if !request.existing_events.contains(&event.id)
1219 && !event.event_ids().any(|id| report.proposals.contains(id)) 1222 && !event
1223 .tags
1224 .event_ids()
1225 .any(|id| report.proposals.contains(id))
1220 { 1226 {
1221 if event.kind.eq(&Kind::GitPatch) && !event_is_patch_set_root(event) { 1227 if event.kind.eq(&Kind::GitPatch) && !event_is_patch_set_root(event) {
1222 report.commits.insert(event.id); 1228 report.commits.insert(event.id);
diff --git a/src/lib/git/mod.rs b/src/lib/git/mod.rs
index 875a336..5d14ce3 100644
--- a/src/lib/git/mod.rs
+++ b/src/lib/git/mod.rs
@@ -6,7 +6,10 @@ use std::{
6use anyhow::{bail, Context, Result}; 6use anyhow::{bail, Context, Result};
7use git2::{DiffOptions, Oid, Revwalk}; 7use git2::{DiffOptions, Oid, Revwalk};
8pub use identify_ahead_behind::identify_ahead_behind; 8pub use identify_ahead_behind::identify_ahead_behind;
9use nostr_sdk::hashes::{sha1::Hash as Sha1Hash, Hash}; 9use nostr_sdk::{
10 hashes::{sha1::Hash as Sha1Hash, Hash},
11 Tags,
12};
10 13
11use crate::git_events::{get_commit_id_from_patch, tag_value}; 14use crate::git_events::{get_commit_id_from_patch, tag_value};
12pub mod identify_ahead_behind; 15pub mod identify_ahead_behind;
@@ -836,10 +839,7 @@ fn git_sig_to_tag_vec(sig: &git2::Signature) -> Vec<String> {
836 ] 839 ]
837} 840}
838 841
839fn extract_sig_from_patch_tags<'a>( 842fn extract_sig_from_patch_tags<'a>(tags: &'a Tags, tag_name: &str) -> Result<git2::Signature<'a>> {
840 tags: &'a [nostr::Tag],
841 tag_name: &str,
842) -> Result<git2::Signature<'a>> {
843 let v = tags 843 let v = tags
844 .iter() 844 .iter()
845 .find(|t| t.as_slice()[0].eq(tag_name)) 845 .find(|t| t.as_slice()[0].eq(tag_name))
@@ -1092,10 +1092,10 @@ mod tests {
1092 fn test(time: git2::Time) -> Result<()> { 1092 fn test(time: git2::Time) -> Result<()> {
1093 assert_eq!( 1093 assert_eq!(
1094 extract_sig_from_patch_tags( 1094 extract_sig_from_patch_tags(
1095 &[nostr::Tag::custom( 1095 &Tags::new(vec![nostr::Tag::custom(
1096 nostr::TagKind::Custom("author".to_string().into()), 1096 nostr::TagKind::Custom("author".to_string().into()),
1097 prep(&time)?, 1097 prep(&time)?,
1098 )], 1098 )]),
1099 "author", 1099 "author",
1100 )? 1100 )?
1101 .to_string(), 1101 .to_string(),
diff --git a/src/lib/repo_ref.rs b/src/lib/repo_ref.rs
index 2468d4d..9bee641 100644
--- a/src/lib/repo_ref.rs
+++ b/src/lib/repo_ref.rs
@@ -105,7 +105,7 @@ impl TryFrom<nostr::Event> for RepoRef {
105 r.events.insert( 105 r.events.insert(
106 Coordinate { 106 Coordinate {
107 kind: event.kind, 107 kind: event.kind,
108 identifier: event.identifier().unwrap().to_string(), 108 identifier: event.tags.identifier().unwrap().to_string(),
109 public_key: event.pubkey, 109 public_key: event.pubkey,
110 relays: vec![], 110 relays: vec![],
111 }, 111 },
@@ -343,7 +343,7 @@ async fn get_repo_coordinates_from_maintainers_yaml(
343 .await?; 343 .await?;
344 } 344 }
345 if let Some(e) = events.first() { 345 if let Some(e) = events.first() {
346 if let Some(identifier) = e.identifier() { 346 if let Some(identifier) = e.tags.identifier() {
347 for m in &repo_config.maintainers { 347 for m in &repo_config.maintainers {
348 if let Ok(maintainer) = PublicKey::parse(m) { 348 if let Ok(maintainer) = PublicKey::parse(m) {
349 repo_coordinates.insert(Coordinate { 349 repo_coordinates.insert(Coordinate {
diff --git a/src/lib/repo_state.rs b/src/lib/repo_state.rs
index c39db34..c3a7606 100644
--- a/src/lib/repo_state.rs
+++ b/src/lib/repo_state.rs
@@ -14,7 +14,7 @@ impl RepoState {
14 state_events.sort_by_key(|e| e.created_at); 14 state_events.sort_by_key(|e| e.created_at);
15 let event = state_events.first().context("no state events")?; 15 let event = state_events.first().context("no state events")?;
16 let mut state = HashMap::new(); 16 let mut state = HashMap::new();
17 for tag in &event.tags { 17 for tag in event.tags.iter() {
18 if let Some(name) = tag.as_slice().first() { 18 if let Some(name) = tag.as_slice().first() {
19 if ["refs/heads/", "refs/tags", "HEAD"] 19 if ["refs/heads/", "refs/tags", "HEAD"]
20 .iter() 20 .iter()
@@ -30,6 +30,7 @@ impl RepoState {
30 } 30 }
31 Ok(RepoState { 31 Ok(RepoState {
32 identifier: event 32 identifier: event
33 .tags
33 .identifier() 34 .identifier()
34 .context("existing event must have an identifier")? 35 .context("existing event must have an identifier")?
35 .to_string(), 36 .to_string(),
diff --git a/test_utils/Cargo.toml b/test_utils/Cargo.toml
index 403e478..f4e0c7e 100644
--- a/test_utils/Cargo.toml
+++ b/test_utils/Cargo.toml
@@ -10,10 +10,10 @@ dialoguer = "0.10.4"
10directories = "5.0.1" 10directories = "5.0.1"
11futures = "0.3.28" 11futures = "0.3.28"
12git2 = "0.19.0" 12git2 = "0.19.0"
13nostr = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 13nostr = { git = "https://github.com/rust-nostr/nostr", rev = "ede2a91" }
14nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 14nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "ede2a91" }
15nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 15nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "ede2a91" }
16nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 16nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", rev = "ede2a91" }
17once_cell = "1.18.0" 17once_cell = "1.18.0"
18rand = "0.8" 18rand = "0.8"
19rexpect = { git = "https://github.com/rust-cli/rexpect.git", rev = "9eb61dd" } 19rexpect = { git = "https://github.com/rust-cli/rexpect.git", rev = "9eb61dd" }
diff --git a/test_utils/src/git.rs b/test_utils/src/git.rs
index 3c19a2c..470cd83 100644
--- a/test_utils/src/git.rs
+++ b/test_utils/src/git.rs
@@ -26,7 +26,7 @@ impl Default for GitTestRepo {
26 let coordinate = Coordinate { 26 let coordinate = Coordinate {
27 kind: Kind::GitRepoAnnouncement, 27 kind: Kind::GitRepoAnnouncement,
28 public_key: repo_event.pubkey, 28 public_key: repo_event.pubkey,
29 identifier: repo_event.identifier().unwrap().to_string(), 29 identifier: repo_event.tags.identifier().unwrap().to_string(),
30 relays: vec![ 30 relays: vec![
31 "ws://localhost:8055".to_string(), 31 "ws://localhost:8055".to_string(),
32 "ws://localhost:8056".to_string(), 32 "ws://localhost:8056".to_string(),
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs
index 57b0643..96558ef 100644
--- a/test_utils/src/lib.rs
+++ b/test_utils/src/lib.rs
@@ -142,7 +142,7 @@ pub fn make_event_old_or_change_user(
142 &keys.public_key(), 142 &keys.public_key(),
143 &unsigned.created_at, 143 &unsigned.created_at,
144 &unsigned.kind, 144 &unsigned.kind,
145 &unsigned.tags, 145 &unsigned.tags.clone().to_vec(),
146 &unsigned.content, 146 &unsigned.content,
147 )); 147 ));
148 148
@@ -1061,13 +1061,14 @@ pub async fn get_events_from_cache(
1061 git_repo_path: &Path, 1061 git_repo_path: &Path,
1062 filters: Vec<nostr::Filter>, 1062 filters: Vec<nostr::Filter>,
1063) -> Result<Vec<nostr::Event>> { 1063) -> Result<Vec<nostr::Event>> {
1064 get_local_cache_database(git_repo_path) 1064 Ok(get_local_cache_database(git_repo_path)
1065 .await? 1065 .await?
1066 .query(filters.clone()) 1066 .query(filters.clone())
1067 .await 1067 .await
1068 .context( 1068 .context(
1069 "cannot execute query on opened git repo nostr cache database .git/nostr-cache.lmdb", 1069 "cannot execute query on opened git repo nostr cache database .git/nostr-cache.lmdb",
1070 ) 1070 )?
1071 .to_vec())
1071} 1072}
1072 1073
1073pub fn get_proposal_branch_name( 1074pub fn get_proposal_branch_name(
@@ -1360,17 +1361,19 @@ fn get_first_proposal_event_id() -> Result<nostr::EventId> {
1360 let client = Client::default(); 1361 let client = Client::default();
1361 Handle::current().block_on(client.add_relay("ws://localhost:8055"))?; 1362 Handle::current().block_on(client.add_relay("ws://localhost:8055"))?;
1362 Handle::current().block_on(client.connect_relay("ws://localhost:8055"))?; 1363 Handle::current().block_on(client.connect_relay("ws://localhost:8055"))?;
1363 let proposals = Handle::current().block_on(client.get_events_of( 1364 let proposals = Handle::current()
1364 vec![ 1365 .block_on(client.fetch_events(
1365 nostr::Filter::default() 1366 vec![
1366 .kind(nostr::Kind::GitPatch) 1367 nostr::Filter::default()
1367 .custom_tag( 1368 .kind(nostr::Kind::GitPatch)
1368 nostr::SingleLetterTag::lowercase(nostr::Alphabet::T), 1369 .custom_tag(
1369 vec!["root"], 1370 nostr::SingleLetterTag::lowercase(nostr::Alphabet::T),
1370 ), 1371 vec!["root"],
1371 ], 1372 ),
1372 nostr_sdk::EventSource::relays(Some(Duration::from_millis(500))), 1373 ],
1373 ))?; 1374 Some(Duration::from_millis(500)),
1375 ))?
1376 .to_vec();
1374 Handle::current().block_on(client.disconnect())?; 1377 Handle::current().block_on(client.disconnect())?;
1375 1378
1376 let proposal_1_id = proposals 1379 let proposal_1_id = proposals
diff --git a/tests/git_remote_nostr/main.rs b/tests/git_remote_nostr/main.rs
index 189d82d..f749c7f 100644
--- a/tests/git_remote_nostr/main.rs
+++ b/tests/git_remote_nostr/main.rs
@@ -21,7 +21,7 @@ fn get_nostr_remote_url() -> Result<String> {
21 let naddr = Coordinate { 21 let naddr = Coordinate {
22 kind: Kind::GitRepoAnnouncement, 22 kind: Kind::GitRepoAnnouncement,
23 public_key: repo_event.pubkey, 23 public_key: repo_event.pubkey,
24 identifier: repo_event.identifier().unwrap().to_string(), 24 identifier: repo_event.tags.identifier().unwrap().to_string(),
25 relays: vec![ 25 relays: vec![
26 "ws://localhost:8055".to_string(), 26 "ws://localhost:8055".to_string(),
27 "ws://localhost:8056".to_string(), 27 "ws://localhost:8056".to_string(),
diff --git a/tests/git_remote_nostr/push.rs b/tests/git_remote_nostr/push.rs
index e0a4e93..b93475c 100644
--- a/tests/git_remote_nostr/push.rs
+++ b/tests/git_remote_nostr/push.rs
@@ -302,8 +302,8 @@ mod two_branches_in_batch_one_added_one_updated {
302 .context("state event not created")?; 302 .context("state event not created")?;
303 303
304 assert_eq!( 304 assert_eq!(
305 state_event.identifier(), 305 state_event.tags.identifier(),
306 generate_repo_ref_event().identifier(), 306 generate_repo_ref_event().tags.identifier(),
307 ); 307 );
308 // println!("{:#?}", state_event); 308 // println!("{:#?}", state_event);
309 assert_eq!( 309 assert_eq!(
diff --git a/tests/ngit_list.rs b/tests/ngit_list.rs
index 26cf717..6382451 100644
--- a/tests/ngit_list.rs
+++ b/tests/ngit_list.rs
@@ -90,7 +90,7 @@ mod cannot_find_repo_event {
90 &Coordinate { 90 &Coordinate {
91 kind: nostr::Kind::GitRepoAnnouncement, 91 kind: nostr::Kind::GitRepoAnnouncement,
92 public_key: TEST_KEY_1_KEYS.public_key(), 92 public_key: TEST_KEY_1_KEYS.public_key(),
93 identifier: repo_event.identifier().unwrap().to_string(), 93 identifier: repo_event.tags.identifier().unwrap().to_string(),
94 relays: vec!["ws://localhost:8056".to_string()], 94 relays: vec!["ws://localhost:8056".to_string()],
95 } 95 }
96 .to_bech32()?, 96 .to_bech32()?,
diff --git a/tests/ngit_send.rs b/tests/ngit_send.rs
index 0fe7a86..620146e 100644
--- a/tests/ngit_send.rs
+++ b/tests/ngit_send.rs
@@ -400,7 +400,7 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_
400 && t.as_slice()[1].eq(&format!( 400 && t.as_slice()[1].eq(&format!(
401 "{}:{TEST_KEY_1_PUBKEY_HEX}:{}", 401 "{}:{TEST_KEY_1_PUBKEY_HEX}:{}",
402 Kind::GitRepoAnnouncement, 402 Kind::GitRepoAnnouncement,
403 generate_repo_ref_event().identifier().unwrap() 403 generate_repo_ref_event().tags.identifier().unwrap()
404 ))) 404 )))
405 ); 405 );
406 assert!( 406 assert!(
@@ -411,7 +411,7 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_
411 && t.as_slice()[1].eq(&format!( 411 && t.as_slice()[1].eq(&format!(
412 "{}:{TEST_KEY_2_PUBKEY_HEX}:{}", 412 "{}:{TEST_KEY_2_PUBKEY_HEX}:{}",
413 Kind::GitRepoAnnouncement, 413 Kind::GitRepoAnnouncement,
414 generate_repo_ref_event().identifier().unwrap() 414 generate_repo_ref_event().tags.identifier().unwrap()
415 ))) 415 )))
416 ); 416 );
417 } 417 }
@@ -606,7 +606,7 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_
606 && t.as_slice()[1].eq(&format!( 606 && t.as_slice()[1].eq(&format!(
607 "{}:{TEST_KEY_1_PUBKEY_HEX}:{}", 607 "{}:{TEST_KEY_1_PUBKEY_HEX}:{}",
608 Kind::GitRepoAnnouncement, 608 Kind::GitRepoAnnouncement,
609 generate_repo_ref_event().identifier().unwrap() 609 generate_repo_ref_event().tags.identifier().unwrap()
610 )) 610 ))
611 })); 611 }));
612 assert!(prep().await?.tags.iter().any(|t| { 612 assert!(prep().await?.tags.iter().any(|t| {
@@ -614,7 +614,7 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_
614 && t.as_slice()[1].eq(&format!( 614 && t.as_slice()[1].eq(&format!(
615 "{}:{TEST_KEY_2_PUBKEY_HEX}:{}", 615 "{}:{TEST_KEY_2_PUBKEY_HEX}:{}",
616 Kind::GitRepoAnnouncement, 616 Kind::GitRepoAnnouncement,
617 generate_repo_ref_event().identifier().unwrap() 617 generate_repo_ref_event().tags.identifier().unwrap()
618 )) 618 ))
619 })); 619 }));
620 Ok(()) 620 Ok(())