upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/sub_commands/send.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-07-23 16:36:06 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-07-23 16:36:06 +0100
commitb67376ff54abeab31422921ba5f4883d5d3dccdb (patch)
treed4f4194fdf2d285332dd7aacea31678042389b00 /src/sub_commands/send.rs
parent643fa17fde858c2d6f934dcc435eb84843cc172e (diff)
feat(list): unique proposal branch names
to prevent accidental name conflicts. also moved to prs/* namespace `pull` and `push` integration tests are intermitantly failing to end at least for `push` they work when run individually but not when run together
Diffstat (limited to 'src/sub_commands/send.rs')
-rw-r--r--src/sub_commands/send.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs
index 33ce104..6b9dd58 100644
--- a/src/sub_commands/send.rs
+++ b/src/sub_commands/send.rs
@@ -769,8 +769,22 @@ pub struct CoverLetter {
769 pub title: String, 769 pub title: String,
770 pub description: String, 770 pub description: String,
771 pub branch_name: String, 771 pub branch_name: String,
772 pub event_id: Option<nostr::EventId>,
772} 773}
773 774
775impl CoverLetter {
776 pub fn get_branch_name(&self) -> Result<String> {
777 Ok(format!(
778 "prs/{}({})",
779 self.branch_name,
780 &self
781 .event_id
782 .context("proposal root event_id must be know to get it's branch name")?
783 .to_hex()
784 .as_str()[..8],
785 ))
786 }
787}
774pub fn event_is_cover_letter(event: &nostr::Event) -> bool { 788pub fn event_is_cover_letter(event: &nostr::Event) -> bool {
775 // TODO: look for Subject:[ PATCH 0/n ] but watch out for: 789 // TODO: look for Subject:[ PATCH 0/n ] but watch out for:
776 // [PATCH v1 0/n ] or 790 // [PATCH v1 0/n ] or
@@ -841,6 +855,7 @@ pub fn event_to_cover_letter(event: &nostr::Event) -> Result<CoverLetter> {
841 .collect(); 855 .collect();
842 s 856 s
843 }, 857 },
858 event_id: Some(event.id()),
844 }) 859 })
845} 860}
846 861