diff options
Diffstat (limited to 'src/lib/git_events.rs')
| -rw-r--r-- | src/lib/git_events.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/lib/git_events.rs b/src/lib/git_events.rs index d8564ae..af469d3 100644 --- a/src/lib/git_events.rs +++ b/src/lib/git_events.rs | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | use std::{str::FromStr, sync::Arc}; | 1 | use std::{str::FromStr, sync::Arc}; |
| 2 | 2 | ||
| 3 | use anyhow::{bail, Context, Result}; | 3 | use anyhow::{Context, Result, bail}; |
| 4 | use nostr::nips::{nip01::Coordinate, nip10::Marker, nip19::Nip19}; | 4 | use nostr::nips::{nip01::Coordinate, nip10::Marker, nip19::Nip19}; |
| 5 | use nostr_sdk::{ | 5 | use nostr_sdk::{ |
| 6 | hashes::sha1::Hash as Sha1Hash, Event, EventBuilder, EventId, FromBech32, Kind, NostrSigner, | 6 | Event, EventBuilder, EventId, FromBech32, Kind, NostrSigner, PublicKey, RelayUrl, Tag, TagKind, |
| 7 | PublicKey, RelayUrl, Tag, TagKind, TagStandard, | 7 | TagStandard, hashes::sha1::Hash as Sha1Hash, |
| 8 | }; | 8 | }; |
| 9 | 9 | ||
| 10 | use crate::{ | 10 | use crate::{ |
| @@ -131,15 +131,14 @@ pub async fn generate_patch_event( | |||
| 131 | // code that makes it into the main branch, assuming | 131 | // code that makes it into the main branch, assuming |
| 132 | // the commit id is correct | 132 | // the commit id is correct |
| 133 | Tag::from_standardized(TagStandard::Reference(commit.to_string())), | 133 | Tag::from_standardized(TagStandard::Reference(commit.to_string())), |
| 134 | Tag::custom( | 134 | Tag::custom(TagKind::Custom(std::borrow::Cow::Borrowed("alt")), vec![ |
| 135 | TagKind::Custom(std::borrow::Cow::Borrowed("alt")), | 135 | format!( |
| 136 | vec![format!( | ||
| 137 | "git patch: {}", | 136 | "git patch: {}", |
| 138 | git_repo | 137 | git_repo |
| 139 | .get_commit_message_summary(commit) | 138 | .get_commit_message_summary(commit) |
| 140 | .unwrap_or_default() | 139 | .unwrap_or_default() |
| 141 | )], | 140 | ), |
| 142 | ), | 141 | ]), |
| 143 | ], | 142 | ], |
| 144 | if let Some(thread_event_id) = thread_event_id { | 143 | if let Some(thread_event_id) = thread_event_id { |
| 145 | vec![Tag::from_standardized(nostr_sdk::TagStandard::Event { | 144 | vec![Tag::from_standardized(nostr_sdk::TagStandard::Event { |
| @@ -203,10 +202,9 @@ pub async fn generate_patch_event( | |||
| 203 | .collect(), | 202 | .collect(), |
| 204 | vec![ | 203 | vec![ |
| 205 | // a fallback is now in place to extract this from the patch | 204 | // a fallback is now in place to extract this from the patch |
| 206 | Tag::custom( | 205 | Tag::custom(TagKind::Custom(std::borrow::Cow::Borrowed("commit")), vec![ |
| 207 | TagKind::Custom(std::borrow::Cow::Borrowed("commit")), | 206 | commit.to_string(), |
| 208 | vec![commit.to_string()], | 207 | ]), |
| 209 | ), | ||
| 210 | // this is required as patches cannot be relied upon to include the 'base | 208 | // this is required as patches cannot be relied upon to include the 'base |
| 211 | // commit' | 209 | // commit' |
| 212 | Tag::custom( | 210 | Tag::custom( |