From a556464452789dc72cb9b0bff8e9ba6addc6639a Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 8 Aug 2024 17:53:42 +0100 Subject: fix(send): patch count fix [PATCH n/n] when no cover letter and patches great than 1 fixes error where the first patch would be [PATCH] followed by [PATCH n/n] --- src/sub_commands/send.rs | 2 +- tests/git_remote_helper.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index f10d2d3..f492734 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs @@ -675,7 +675,7 @@ pub async fn generate_cover_letter_and_patch_events( signer, repo_ref, events.last().map(nostr::Event::id), - if events.is_empty() { + if events.is_empty() && commits.len().eq(&1) { None } else { Some(((i + 1).try_into()?, commits.len().try_into()?)) diff --git a/tests/git_remote_helper.rs b/tests/git_remote_helper.rs index 379954d..f768806 100644 --- a/tests/git_remote_helper.rs +++ b/tests/git_remote_helper.rs @@ -1965,7 +1965,7 @@ mod push { assert!( revision_root_patch.content.contains("[PATCH 1/3]"), - "revision root labeled with [PATCH 1/3]" + "revision root labeled with [PATCH 1/3] event: {revision_root_patch:?}", ); let second_patch = new_events -- cgit v1.2.3