upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/git_remote_nostr/push.rs15
-rw-r--r--src/bin/git_remote_nostr/utils.rs6
-rw-r--r--src/bin/ngit/sub_commands/list.rs6
3 files changed, 17 insertions, 10 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index 6116fe2..4066312 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -1010,7 +1010,8 @@ async fn get_merged_proposals_info(
1010 .iter() 1010 .iter()
1011 .filter(|e| { 1011 .filter(|e| {
1012 e.tags.iter().any(|t| { 1012 e.tags.iter().any(|t| {
1013 t.as_slice()[0].eq("commit") 1013 t.as_slice().len() > 1
1014 && t.as_slice()[0].eq("commit")
1014 && t.as_slice()[1].eq(&parent.id().to_string()) 1015 && t.as_slice()[1].eq(&parent.id().to_string())
1015 }) 1016 })
1016 }) 1017 })
@@ -1034,7 +1035,9 @@ async fn get_merged_proposals_info(
1034 .iter() 1035 .iter()
1035 .filter(|e| { 1036 .filter(|e| {
1036 e.tags.iter().any(|t| { 1037 e.tags.iter().any(|t| {
1037 t.as_slice()[0].eq("commit") && t.as_slice()[1].eq(&commit_hash.to_string()) 1038 t.as_slice().len() > 1
1039 && t.as_slice()[0].eq("commit")
1040 && t.as_slice()[1].eq(&commit_hash.to_string())
1038 }) 1041 })
1039 }) 1042 })
1040 .collect::<Vec<&Event>>() 1043 .collect::<Vec<&Event>>()
@@ -1228,7 +1231,11 @@ async fn get_proposal_and_revision_root_from_patch(
1228 git_repo: &Repo, 1231 git_repo: &Repo,
1229 patch: &Event, 1232 patch: &Event,
1230) -> Result<(EventId, Option<EventId>)> { 1233) -> Result<(EventId, Option<EventId>)> {
1231 let proposal_or_revision = if patch.tags.iter().any(|t| t.as_slice()[1].eq("root")) { 1234 let proposal_or_revision = if patch
1235 .tags
1236 .iter()
1237 .any(|t| t.as_slice().len() > 1 && t.as_slice()[1].eq("root"))
1238 {
1232 patch.clone() 1239 patch.clone()
1233 } else { 1240 } else {
1234 let proposal_or_revision_id = EventId::parse( 1241 let proposal_or_revision_id = EventId::parse(
@@ -1260,7 +1267,7 @@ async fn get_proposal_and_revision_root_from_patch(
1260 if proposal_or_revision 1267 if proposal_or_revision
1261 .tags 1268 .tags
1262 .iter() 1269 .iter()
1263 .any(|t| t.as_slice()[1].eq("revision-root")) 1270 .any(|t| t.as_slice().len() > 1 && t.as_slice()[1].eq("revision-root"))
1264 { 1271 {
1265 Ok(( 1272 Ok((
1266 EventId::parse( 1273 EventId::parse(
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs
index b54ce6b..5efb6e0 100644
--- a/src/bin/git_remote_nostr/utils.rs
+++ b/src/bin/git_remote_nostr/utils.rs
@@ -128,9 +128,9 @@ pub async fn get_open_proposals(
128 .iter() 128 .iter()
129 .filter(|e| { 129 .filter(|e| {
130 status_kinds().contains(&e.kind) 130 status_kinds().contains(&e.kind)
131 && e.tags 131 && e.tags.iter().any(|t| {
132 .iter() 132 t.as_slice().len() > 1 && t.as_slice()[1].eq(&proposal.id.to_string())
133 .any(|t| t.as_slice()[1].eq(&proposal.id.to_string())) 133 })
134 }) 134 })
135 .collect::<Vec<&nostr::Event>>() 135 .collect::<Vec<&nostr::Event>>()
136 .first() 136 .first()
diff --git a/src/bin/ngit/sub_commands/list.rs b/src/bin/ngit/sub_commands/list.rs
index b7bfd24..ee015ef 100644
--- a/src/bin/ngit/sub_commands/list.rs
+++ b/src/bin/ngit/sub_commands/list.rs
@@ -77,9 +77,9 @@ pub async fn launch() -> Result<()> {
77 .iter() 77 .iter()
78 .filter(|e| { 78 .filter(|e| {
79 status_kinds().contains(&e.kind) 79 status_kinds().contains(&e.kind)
80 && e.tags 80 && e.tags.iter().any(|t| {
81 .iter() 81 t.as_slice().len() > 1 && t.as_slice()[1].eq(&proposal.id.to_string())
82 .any(|t| t.as_slice()[1].eq(&proposal.id.to_string())) 82 })
83 }) 83 })
84 .collect::<Vec<&nostr::Event>>() 84 .collect::<Vec<&nostr::Event>>()
85 .first() 85 .first()