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

Re: [RFC-PATCH 1/2] send-email: new option to quote an email and reply to

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
May 23, 2016, 20:00 UTC
Message-ID
<vpq60u4bl4e.fsf@anie.imag.fr>
In-Reply-To
<1464031829-6107-2-git-send-email-tom.russello@grenoble-inp.org>
Tom Russello <tom.russello@grenoble-inp.org> writes:
> This option involves the `--compose` mode to edit the cover letter quoting the
s/involves/implies/
?

I don't think this is right: I often reply to an email with a single patch, for which it would clearly be overkill to have a cover-letter.

Your --quote-mail does two things:
1) Populate the To and Cc field
2) Include the original message body with quotation prefix.

When not using --compose, 1) clearly makes sense already, and there's no reason to prevent this use-case. When sending a single patch, 2) also makes sense as "below-tripple-dash comment", like

  This is the commit message for feature A.
  ---
  John Smith wrote:
  > You should implement feature A.
  Indeed, here's a patch.
  modified-file.c   | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-

When sending multiple patches without --compose, 2) may not make sense, but I think a sane behavior would be:

* If --compose is given, cite the message there.
* If --compose is not given, don't send a cover-letter but cite the body
  as comment in the first patch.

As a first step, the second point can be changed to "if --compose is not given, don't cite the message, just populate the To: and Cc: fields".

> ---
>
> diff --git a/git-send-email.perl b/git-send-email.perl
No diffstat?
Show 6 quoted lines
> @@ -638,6 +640,98 @@ if (@files) {
>  	print STDERR "\nNo patch files specified!\n\n";
>  	usage();
>  }
> +my $message_quoted;
> +if ($quote_mail) {
Style: The code you're adding doesn't look related to the code right
before => separate them with a blank line.
> +	while(<$fh>) {
Style: space before (.
> +			push(@header, $_);

I think the code would be clearer if @header was a list of pairs (header-name, header-content). Then you'd need much less regex magic when going through it.

> +		#for files containing crlf line endings
Sytle: space after #.
> +	foreach(@header) {
Space before (.
Show 9 quoted lines
> +			elsif (/^From:\s+(.*)$/i) {
> +				push @initial_to, $1;
> +			}
> +			elsif (/^To:\s+(.*)$/i) {
> +				foreach my $addr (parse_address_line($1)) {
> +					if (!($addr eq $initial_sender)) {
> +						push @initial_to, $addr;
> +					}
> +				}

This adds the content of the To: field in the original email to the Cc: field in the new message, right? If so, this is a weird behavior: when following up to an email, one usually addresses to the person s/he's replying, keeping the others Cc-ed, hence the original From: becomes the To header, and the original To: and Cc: become Cc:.

> +			} elsif (/^Cc:\s+(.*)$/i) {
Style: IIRC, there's no consensus on whether "elsif" should be on the
same line as the closing }, but please follow the same convention inside
a single if/elsif/ chain.
> +	#Message body
Style: space after # (more below). And while you're there, the comment
could be "Quote the message body" or so, to give a hint to the user
about what's going on.
> +	while (<$fh>) {
> +		#for files containing crlf line endings
> +		$_=~ s/\r//g;
> +		my $space="";
Style: spaces around =.
Show 7 quoted lines
> @@ -676,6 +771,8 @@ From: $tpl_sender
>  Subject: $tpl_subject
>  In-Reply-To: $tpl_reply_to
>  
> +$tpl_quote
> +
>  EOT
Doesn't this add two extra useless blank lines if $tpl_quote is empty?
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Eric WongNext: Samuel GROOT
Message 11 of 96 in “send-email: new --quote-mail option”
  1. 0/2 send-email: new --quote-mail optionTom Russello, May 23, 2016
  2. 1/2 send-email: new option to quote an email and reply toTom Russello, May 23, 2016
  3. Eric WongMay 23, 2016
  4. Matthieu MoyMay 23, 2016
  5. Samuel GROOTMay 23, 2016
  6. Samuel GROOTMay 24, 2016
  7. Matthieu MoyMay 24, 2016
  8. Aaron SchrabMay 24, 2016
  9. Tom RusselloMay 25, 2016
  10. Eric WongMay 24, 2016
  11. Matthieu MoyMay 23, 2016
  12. Samuel GROOTMay 24, 2016
  13. Matthieu MoyMay 25, 2016
  14. Junio C HamanoMay 25, 2016
  15. Matthieu MoyMay 25, 2016
  16. Junio C HamanoMay 25, 2016
  17. Matthieu MoyMay 25, 2016
  18. Samuel GROOTMay 26, 2016
  19. Matthieu MoyMay 27, 2016
  20. 2/2 t9001: adding --quote-mail option testTom Russello, May 23, 2016
  21. Matthieu MoyMay 23, 2016
  22. Matthieu MoyMay 23, 2016
  23. Samuel GROOTMay 23, 2016
  24. 0/2 send-email: new --quote-email optionTom Russello, May 27, 2016
  25. 1/2 send-email: quote-email populates the fieldsTom Russello, May 27, 2016
  26. Matthieu MoyMay 28, 2016
  27. Tom RusselloMay 29, 2016
  28. 2/2 send-email: quote-email quotes the message bodyTom Russello, May 27, 2016
  29. Matthieu MoyMay 28, 2016
  30. Tom RusselloMay 29, 2016
  31. 0/6 send-email: cleaner tests and quote emailTom Russello, Jun 7, 2016
  32. 1/6 t9001: non order-sensitive file comparisonTom Russello, Jun 7, 2016
  33. Junio C HamanoJun 8, 2016
  34. Samuel GROOTJun 8, 2016
  35. Junio C HamanoJun 8, 2016
  36. Samuel GROOTJun 8, 2016
  37. Matthieu MoyJun 9, 2016
  38. Samuel GROOTJun 13, 2016
  39. Matthieu MoyJun 9, 2016
  40. Tom RusselloJun 9, 2016
  41. 2/6 t9001: check email address is in Cc: fieldTom Russello, Jun 7, 2016
  42. Matthieu MoyJun 9, 2016
  43. Samuel GROOTJun 13, 2016
  44. 3/6 t9001: shorten send-email's outputTom Russello, Jun 7, 2016
  45. Eric WongJun 8, 2016
  46. Samuel GROOTJun 8, 2016
  47. Matthieu MoyJun 9, 2016
  48. 4/6 send-email: create email parser subroutineTom Russello, Jun 7, 2016
  49. 5/6 send-email: --in-reply-to=<file> populates the fieldsTom Russello, Jun 7, 2016
  50. 6/6 send-email: add option --cite to quote the message bodyTom Russello, Jun 7, 2016
  51. (unknown)Samuel GROOT, Jun 8, 2016
  52. 1/6 t9001: non order-sensitive file comparisonSamuel GROOT, Jun 8, 2016
  53. Remi Galan AlfonsoJun 8, 2016
  54. Samuel GROOTJun 8, 2016
  55. Junio C HamanoJun 8, 2016
  56. Samuel GROOTJun 8, 2016
  57. Junio C HamanoJun 8, 2016
  58. Samuel GROOTJun 8, 2016
  59. 2/6 t9001: check email address is in Cc: fieldSamuel GROOT, Jun 8, 2016
  60. Junio C HamanoJun 8, 2016
  61. Samuel GROOTJun 8, 2016
  62. 3/6 send-email: shorten send-email's outputSamuel GROOT, Jun 8, 2016
  63. Junio C HamanoJun 8, 2016
  64. Samuel GROOTJun 8, 2016
  65. Junio C HamanoJun 8, 2016
  66. Samuel GROOTJun 8, 2016
  67. Matthieu MoyJun 9, 2016
  68. Samuel GROOTJun 13, 2016
  69. 4/6 send-email: create email parser subroutineSamuel GROOT, Jun 8, 2016
  70. Junio C HamanoJun 8, 2016
  71. Eric SunshineJun 8, 2016
  72. Junio C HamanoJun 8, 2016
  73. Samuel GROOTJun 8, 2016
  74. Junio C HamanoJun 8, 2016
  75. Samuel GROOTJun 8, 2016
  76. Samuel GROOTJun 8, 2016
  77. Eric SunshineJun 8, 2016
  78. Junio C HamanoJun 8, 2016
  79. Samuel GROOTJun 8, 2016
  80. Eric WongJun 9, 2016
  81. Samuel GROOTJun 13, 2016
  82. Eric WongJun 13, 2016
  83. Samuel GROOTJun 14, 2016
  84. Eric SunshineJun 9, 2016
  85. Samuel GROOTJun 13, 2016
  86. Samuel GROOTJun 8, 2016
  87. Eric WongJun 8, 2016
  88. 5/6 send-email: --in-reply-to=<file> populate header fieldsSamuel GROOT, Jun 8, 2016
  89. Junio C HamanoJun 8, 2016
  90. Samuel GROOTJun 14, 2016
  91. Matthieu MoyJun 9, 2016
  92. Samuel GROOTJun 14, 2016
  93. 6/6 send-email: add option --cite to quote the message bodySamuel GROOT, Jun 8, 2016
  94. Matthieu MoyJun 9, 2016
  95. Samuel GROOTJun 14, 2016
  96. Tom RusselloJun 15, 2016

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.