git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/1] send-email: allow to compose only prepared cover letter

From
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date
Oct 13, 2015, 16:12 UTC
Message-ID
<1444752768-82136-1-git-send-email-andriy.shevchenko@linux.intel.com>

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
Next: Junio C Hamano
Message 1 of 3 in “send-email: allow to compose only prepared cover letter”
  1. 1/1 send-email: allow to compose only prepared cover letterAndy Shevchenko, Oct 13, 2015
  2. Junio C HamanoOct 13, 2015
  3. Andy ShevchenkoOct 14, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.