diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/repo_ref.rs | 15 | ||||
| -rw-r--r-- | src/sub_commands/send.rs | 10 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/repo_ref.rs b/src/repo_ref.rs index 3e8db64..d314e6d 100644 --- a/src/repo_ref.rs +++ b/src/repo_ref.rs | |||
| @@ -136,6 +136,10 @@ impl RepoRef { | |||
| 136 | .map(std::string::ToString::to_string) | 136 | .map(std::string::ToString::to_string) |
| 137 | .collect(), | 137 | .collect(), |
| 138 | ), | 138 | ), |
| 139 | Tag::Generic( | ||
| 140 | nostr::TagKind::Custom("alt".to_string()), | ||
| 141 | vec![format!("git repository: {}", self.name.clone())], | ||
| 142 | ), | ||
| 139 | ], | 143 | ], |
| 140 | // code languages and hashtags | 144 | // code languages and hashtags |
| 141 | ] | 145 | ] |
| @@ -451,6 +455,15 @@ mod tests { | |||
| 451 | .any(|t| t.as_vec()[0].eq("name") && t.as_vec()[1].eq("test name")) | 455 | .any(|t| t.as_vec()[0].eq("name") && t.as_vec()[1].eq("test name")) |
| 452 | ) | 456 | ) |
| 453 | } | 457 | } |
| 458 | |||
| 459 | #[test] | ||
| 460 | fn alt() { | ||
| 461 | assert!( | ||
| 462 | create().tags.iter().any(|t| t.as_vec()[0].eq("alt") | ||
| 463 | && t.as_vec()[1].eq("git repository: test name")) | ||
| 464 | ) | ||
| 465 | } | ||
| 466 | |||
| 454 | #[test] | 467 | #[test] |
| 455 | fn description() { | 468 | fn description() { |
| 456 | assert!(create().tags.iter().any( | 469 | assert!(create().tags.iter().any( |
| @@ -515,7 +528,7 @@ mod tests { | |||
| 515 | 528 | ||
| 516 | #[test] | 529 | #[test] |
| 517 | fn no_other_tags() { | 530 | fn no_other_tags() { |
| 518 | assert_eq!(create().tags.len(), 8) | 531 | assert_eq!(create().tags.len(), 9) |
| 519 | } | 532 | } |
| 520 | } | 533 | } |
| 521 | } | 534 | } |
diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 4639b01..189dc53 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs | |||
| @@ -649,6 +649,10 @@ pub fn generate_cover_letter_and_patch_events( | |||
| 649 | }, | 649 | }, |
| 650 | Tag::Reference(format!("{root_commit}")), | 650 | Tag::Reference(format!("{root_commit}")), |
| 651 | Tag::Hashtag("cover-letter".to_string()), | 651 | Tag::Hashtag("cover-letter".to_string()), |
| 652 | Tag::Generic( | ||
| 653 | nostr::TagKind::Custom("alt".to_string()), | ||
| 654 | vec![format!("git patch cover letter: {}", title.clone())], | ||
| 655 | ), | ||
| 652 | ], | 656 | ], |
| 653 | if let Some(event_ref) = root_proposal_id.clone() { | 657 | if let Some(event_ref) = root_proposal_id.clone() { |
| 654 | vec![ | 658 | vec![ |
| @@ -895,6 +899,7 @@ pub fn patch_supports_commit_ids(event: &nostr::Event) -> bool { | |||
| 895 | } | 899 | } |
| 896 | 900 | ||
| 897 | #[allow(clippy::too_many_arguments)] | 901 | #[allow(clippy::too_many_arguments)] |
| 902 | #[allow(clippy::too_many_lines)] | ||
| 898 | pub fn generate_patch_event( | 903 | pub fn generate_patch_event( |
| 899 | git_repo: &Repo, | 904 | git_repo: &Repo, |
| 900 | root_commit: &Sha1Hash, | 905 | root_commit: &Sha1Hash, |
| @@ -912,6 +917,7 @@ pub fn generate_patch_event( | |||
| 912 | .get_commit_parent(commit) | 917 | .get_commit_parent(commit) |
| 913 | .context("failed to get parent commit")?; | 918 | .context("failed to get parent commit")?; |
| 914 | let relay_hint = repo_ref.relays.first().map(nostr::UncheckedUrl::from); | 919 | let relay_hint = repo_ref.relays.first().map(nostr::UncheckedUrl::from); |
| 920 | |||
| 915 | EventBuilder::new( | 921 | EventBuilder::new( |
| 916 | nostr::event::Kind::Custom(PATCH_KIND), | 922 | nostr::event::Kind::Custom(PATCH_KIND), |
| 917 | git_repo | 923 | git_repo |
| @@ -937,6 +943,10 @@ pub fn generate_patch_event( | |||
| 937 | // code that makes it into the main branch, assuming | 943 | // code that makes it into the main branch, assuming |
| 938 | // the commit id is correct | 944 | // the commit id is correct |
| 939 | Tag::Reference(commit.to_string()), | 945 | Tag::Reference(commit.to_string()), |
| 946 | Tag::Generic( | ||
| 947 | nostr::TagKind::Custom("alt".to_string()), | ||
| 948 | vec![format!("git patch: {}", git_repo.get_commit_message_summary(commit).unwrap_or_default())], | ||
| 949 | ), | ||
| 940 | ], | 950 | ], |
| 941 | 951 | ||
| 942 | if let Some(thread_event_id) = thread_event_id { | 952 | if let Some(thread_event_id) = thread_event_id { |