git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] send-email: allow to compose only prepared cover letter
@ 2015-10-13 16:12 Andy Shevchenko
  2015-10-13 21:11 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2015-10-13 16:12 UTC (permalink / raw)
  To: Eric Sunshine, Junio C Hamano, git; +Cc: Andy Shevchenko

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] send-email: allow to compose only prepared cover letter
  2015-10-13 16:12 [PATCH 1/1] send-email: allow to compose only prepared cover letter Andy Shevchenko
@ 2015-10-13 21:11 ` Junio C Hamano
  2015-10-14  9:42   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2015-10-13 21:11 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Eric Sunshine, git

Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:

> 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*

I guess this patch would not hurt too much, but the above would
vastly be improved if you used "-vN" option, instead of the
hand-rolled subject prefix, and dropped the last "rm -f" (which in
turn would mean you would want to use -o option to specify where to
keep the older iterations of the topic).  Then you can easily refer
to cover letters and patches from previous rounds while preparing
the latest to send out.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] send-email: allow to compose only prepared cover letter
  2015-10-13 21:11 ` Junio C Hamano
@ 2015-10-14  9:42   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2015-10-14  9:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Eric Sunshine, git

On Tue, 2015-10-13 at 14:11 -0700, Junio C Hamano wrote:
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> 
> > 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*
> 
> I guess this patch would not hurt too much, but the above would
> vastly be improved if you used "-vN" option, instead of the
> hand-rolled subject prefix, and dropped the last "rm -f" (which in
> turn would mean you would want to use -o option to specify where to
> keep the older iterations of the topic).  Then you can easily refer
> to cover letters and patches from previous rounds while preparing
> the latest to send out.

Thanks!

The patch I sent was a modification of previous variant I have. It
unfortunately misses undef $compose; line in the first conditional
branch.

Besides that I found that --annotate might be a workaround and it comes
a burden of editor how to avoid editing every patch but first.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-14  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 16:12 [PATCH 1/1] send-email: allow to compose only prepared cover letter Andy Shevchenko
2015-10-13 21:11 ` Junio C Hamano
2015-10-14  9:42   ` Andy Shevchenko

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).