From patchwork Thu Oct 12 11:27:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 13418893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA900CDB46E for ; Thu, 12 Oct 2023 11:27:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347161AbjJLL1w (ORCPT ); Thu, 12 Oct 2023 07:27:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343649AbjJLL1v (ORCPT ); Thu, 12 Oct 2023 07:27:51 -0400 Received: from imap5.colo.codethink.co.uk (imap5.colo.codethink.co.uk [78.40.148.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDBB191 for ; Thu, 12 Oct 2023 04:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codethink.co.uk; s=imap5-20230908; h=Sender:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+T/G5jdpQpWFP3WoI9OXwsFJdnk2rogHMLfcY/qlltc=; b=YILFDGxJqnLjXP/GZDP10jOP5S knM8TpSP59FW00IflPFYB9IS486dkY3wkr3c+OEYxKMgpgvSMPX9ZDgGw3AXHWsqkquhiSZHek11k hoIVYNaruIV6REV0bTZMSSD1fgHK/uGBskzgJAySepG5LeHQcyRPM8Y5kWJBw3OWXQ+UOL1VJNBp0 e9pskXM9XUjrBw7oDUsErqERhC26s75u10tDt/gliT6cVPdkEGA73YdjMqBI8gkBMGGi44jbjSDVs kij3dyeJrAuea3SQn4j7YZXsWeLJkV75JwQXR5ubLGLBuVsctFTGy0ztxEfY8TZocjqwk/xJsmScW VlFL0Klg==; Received: from [63.135.74.212] (helo=rainbowdash) by imap5.colo.codethink.co.uk with esmtpsa (Exim 4.94.2 #2 (Debian)) id 1qqtqy-000Qby-E1; Thu, 12 Oct 2023 12:27:45 +0100 Received: from ben by rainbowdash with local (Exim 4.97-RC1) (envelope-from ) id 1qqtqz-0000000BZ22-12zp; Thu, 12 Oct 2023 12:27:45 +0100 From: Ben Dooks To: git@vger.kernel.org, gitster@pobox.com Cc: Ben Dooks Subject: [PATCH] send-email: add --compose-cover option Date: Thu, 12 Oct 2023 12:27:43 +0100 Message-ID: <20231012112743.2756259-1-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Sender: srv_ts003@codethink.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Adding an option to automatically compose a cover letter would be helpful to put the whole process of sending an series with a cover into one command. Signed-off-by: Ben Dooks --- Documentation/git-send-email.txt | 5 +++++ git-send-email.perl | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 41cd8cb424..f299732867 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -78,6 +78,11 @@ Missing From or In-Reply-To headers will be prompted for. + See the CONFIGURATION section for `sendemail.multiEdit`. +--compose-cover:: + Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1]) + to edit a cover letter generated by passing --cover-letter to + git-send-email before invoking the editor. + --from=
:: Specify the sender of the emails. If not specified on the command line, the value of the `sendemail.from` configuration option is used. If diff --git a/git-send-email.perl b/git-send-email.perl index 5861e99a6e..debec088f6 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -54,6 +54,7 @@ sub usage { --in-reply-to * Email "In-Reply-To:" --[no-]xmailer * Add "X-Mailer:" header (default). --[no-]annotate * Review each patch that will be sent in an editor. + --compose-cover * Open an editor on format-patch --cover-letter --compose * Open an editor for introduction. --compose-encoding * Encoding to assume for introduction. --8bit-encoding * Encoding to assume 8bit mails if undeclared @@ -199,7 +200,7 @@ sub format_2822_time { # Variables we fill in automatically, or via prompting: my (@to,@cc,@xh,$envelope_sender, $initial_in_reply_to,$reply_to,$initial_subject,@files, - $author,$sender,$smtp_authpass,$annotate,$compose,$time); + $author,$sender,$smtp_authpass,$annotate,$compose_cover,$compose,$time); # Things we either get from config, *or* are overridden on the # command-line. my ($no_cc, $no_to, $no_bcc, $no_identity); @@ -512,6 +513,7 @@ sub config_regexp { "no-smtp-auth" => sub {$smtp_auth = 'none'}, "annotate!" => \$annotate, "no-annotate" => sub {$annotate = 0}, + "compose-cover" => \$compose_cover, "compose" => \$compose, "quiet" => \$quiet, "cc-cmd=s" => \$cc_cmd, @@ -782,6 +784,9 @@ sub is_format_patch_arg { die __("Cannot run git format-patch from outside a repository\n") unless $repo; require File::Temp; + if ($compose_cover) { + push @rev_list_opts, "--cover-letter"; + } push @files, $repo->command('format-patch', '-o', File::Temp::tempdir(CLEANUP => 1), @rev_list_opts); } @@ -854,6 +859,8 @@ sub get_patch_subject { if ($annotate) { do_edit($compose_filename, @files); + } elsif ($compose_cover) { + do_edit($files[0]); } else { do_edit($compose_filename); } @@ -927,6 +934,8 @@ sub get_patch_subject { } elsif ($annotate) { do_edit(@files); +} elsif ($compose_cover) { + do_edit($files[0]); } sub term {