{"thread":{"id":"40550","subject":"[PATCH 1/1] send-email: allow to compose only prepared cover letter","startedAt":"2015-10-13T16:12:48Z","lastAt":"2015-10-14T09:42:19Z","messageCount":3,"participants":["Andy Shevchenko","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"271578","messageId":"1444752768-82136-1-git-send-email-andriy.shevchenko@linux.intel.com","threadId":"40550","inReplyTo":null,"subject":"[PATCH 1/1] send-email: allow to compose only prepared cover letter","fromName":"Andy Shevchenko","fromEmail":"andriy.shevchenko@linux.intel.com","sentAt":"2015-10-13T16:12:48Z","receivedAt":"2015-10-13T16:12:48Z","isPatch":true,"sender":{"key":"andriy.shevchenko@linux.intel.com","avatar":"https://gravatar.com/avatar/507bf7f59fddb7004f6bf72b211f6216082913376b9d961221004ab9481d97ca?d=mp&s=160"},"body":"Since @rev_list_opts contains everything that goes to the git format-patch\nincluding an additional option like '--cover-letter' we might be interested to\ncompose it before send.\n\nMy often use case is to do:\n\t% git format-patch --cover-letter --subject-prefix=\"PATCH vN\" rev1^..revXYZ\n\t% $GIT_EDITOR 0000-*\n\t% git send-email 00* # assumes series less than 100 patches\n\t% rm -f 00*\n\nSince git-send-email may send directly from repository it would be nice to\nreduce above to just\n\t% git send-email --compose --cover-letter --subject-prefix=\"PATCH vN\" rev1^..revXYZ\n\nP.S. Going further we can even introduce something like --valid-cmd to\nsend-email to run, for example, checkpatch.pl.\n\nSigned-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>\n---\n git-send-email.perl | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex e3ff44b..fc62d28 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -631,7 +631,10 @@ sub get_patch_subject {\n \tdie \"No subject line in $fn ?\";\n }\n \n-if ($compose) {\n+if ($compose and @rev_list_opts and grep { $_ eq '--cover-letter' } @rev_list_opts) {\n+\t# Cover letter always goes first\n+\tdo_edit($files[0]);\n+} elsif ($compose) {\n \t# Note that this does not need to be secure, but we will make a small\n \t# effort to have it be unique\n \t$compose_filename = ($repo ?\n-- \n2.5.3\n"},{"id":"271595","messageId":"xmqqa8rma2xx.fsf@gitster.mtv.corp.google.com","threadId":"40550","inReplyTo":"1444752768-82136-1-git-send-email-andriy.shevchenko@linux.intel.com","subject":"Re: [PATCH 1/1] send-email: allow to compose only prepared cover letter","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-10-13T21:11:54Z","receivedAt":"2015-10-13T21:11:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:\n\n> My often use case is to do:\n> \t% git format-patch --cover-letter --subject-prefix=\"PATCH vN\" rev1^..revXYZ\n> \t% $GIT_EDITOR 0000-*\n> \t% git send-email 00* # assumes series less than 100 patches\n> \t% rm -f 00*\n\nI guess this patch would not hurt too much, but the above would\nvastly be improved if you used \"-vN\" option, instead of the\nhand-rolled subject prefix, and dropped the last \"rm -f\" (which in\nturn would mean you would want to use -o option to specify where to\nkeep the older iterations of the topic).  Then you can easily refer\nto cover letters and patches from previous rounds while preparing\nthe latest to send out.\n"},{"id":"271637","messageId":"1444815739.8361.621.camel@linux.intel.com","threadId":"40550","inReplyTo":"xmqqa8rma2xx.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 1/1] send-email: allow to compose only prepared cover letter","fromName":"Andy Shevchenko","fromEmail":"andriy.shevchenko@linux.intel.com","sentAt":"2015-10-14T09:42:19Z","receivedAt":"2015-10-14T09:42:19Z","isPatch":true,"sender":{"key":"andriy.shevchenko@linux.intel.com","avatar":"https://gravatar.com/avatar/507bf7f59fddb7004f6bf72b211f6216082913376b9d961221004ab9481d97ca?d=mp&s=160"},"body":"On Tue, 2015-10-13 at 14:11 -0700, Junio C Hamano wrote:\n> Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:\n> \n> > My often use case is to do:\n> > \t% git format-patch --cover-letter --subject-prefix=\"PATCH \n> > vN\" rev1^..revXYZ\n> > \t% $GIT_EDITOR 0000-*\n> > \t% git send-email 00* # assumes series less than 100 \n> > patches\n> > \t% rm -f 00*\n> \n> I guess this patch would not hurt too much, but the above would\n> vastly be improved if you used \"-vN\" option, instead of the\n> hand-rolled subject prefix, and dropped the last \"rm -f\" (which in\n> turn would mean you would want to use -o option to specify where to\n> keep the older iterations of the topic).  Then you can easily refer\n> to cover letters and patches from previous rounds while preparing\n> the latest to send out.\n\nThanks!\n\nThe patch I sent was a modification of previous variant I have. It\nunfortunately misses undef $compose; line in the first conditional\nbranch.\n\nBesides that I found that --annotate might be a workaround and it comes\na burden of editor how to avoid editing every patch but first.\n\n-- \nAndy Shevchenko <andriy.shevchenko@linux.intel.com>\nIntel Finland Oy\n"}]}