git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Eric Sunshine <sunshine@sunshineco.com>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH 1/1] send-email: allow to compose only prepared cover letter
Date: Tue, 13 Oct 2015 19:12:48 +0300	[thread overview]
Message-ID: <1444752768-82136-1-git-send-email-andriy.shevchenko@linux.intel.com> (raw)

Since @rev_list_opts contains everything that goes to the git format-patch
including an additional option like '--cover-letter' we might be interested to
compose it before send.

My often use case is to do:
	% git format-patch --cover-letter --subject-prefix="PATCH vN" rev1^..revXYZ
	% $GIT_EDITOR 0000-*
	% git send-email 00* # assumes series less than 100 patches
	% rm -f 00*

Since git-send-email may send directly from repository it would be nice to
reduce above to just
	% git send-email --compose --cover-letter --subject-prefix="PATCH vN" rev1^..revXYZ

P.S. Going further we can even introduce something like --valid-cmd to
send-email to run, for example, checkpatch.pl.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 git-send-email.perl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index e3ff44b..fc62d28 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -631,7 +631,10 @@ sub get_patch_subject {
 	die "No subject line in $fn ?";
 }
 
-if ($compose) {
+if ($compose and @rev_list_opts and grep { $_ eq '--cover-letter' } @rev_list_opts) {
+	# Cover letter always goes first
+	do_edit($files[0]);
+} elsif ($compose) {
 	# Note that this does not need to be secure, but we will make a small
 	# effort to have it be unique
 	$compose_filename = ($repo ?
-- 
2.5.3

             reply	other threads:[~2015-10-13 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 16:12 Andy Shevchenko [this message]
2015-10-13 21:11 ` [PATCH 1/1] send-email: allow to compose only prepared cover letter Junio C Hamano
2015-10-14  9:42   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444752768-82136-1-git-send-email-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).