From b67376ff54abeab31422921ba5f4883d5d3dccdb Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 23 Jul 2024 16:36:06 +0100 Subject: 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 --- src/sub_commands/send.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/sub_commands/send.rs') 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 { pub title: String, pub description: String, pub branch_name: String, + pub event_id: Option, } +impl CoverLetter { + pub fn get_branch_name(&self) -> Result { + Ok(format!( + "prs/{}({})", + self.branch_name, + &self + .event_id + .context("proposal root event_id must be know to get it's branch name")? + .to_hex() + .as_str()[..8], + )) + } +} pub fn event_is_cover_letter(event: &nostr::Event) -> bool { // TODO: look for Subject:[ PATCH 0/n ] but watch out for: // [PATCH v1 0/n ] or @@ -841,6 +855,7 @@ pub fn event_to_cover_letter(event: &nostr::Event) -> Result { .collect(); s }, + event_id: Some(event.id()), }) } -- cgit v1.2.3