threads / patch / 18063

patchfix git format-patch --cc=<email> format

Subject: [PATCH] fix git format-patch --cc=<email> format

## tl;dr

5 messages between Feb 28, 2009 and Mar 1, 2009. Diffs are folded; open one to read it.

replies: 4people: 4as markdown or json

Peng Tao· Feb 28, 2009, 12:42 UTC · lore
If there are multiple --cc=<email> arguments, git format-patch will generate
patches with cc lines like:
  Cc: <email>,
      <email>
which git send-email fails to parse.
git send-email only accept formats like:
  Cc: <email>
  Cc: <email>
So change git format-patch to generate patches in a proper format.
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
 builtin-log.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
Show changes to builtin-log.c +1 −5
diff --git a/builtin-log.c b/builtin-log.c
index 60f8dd8..22bb6b6 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -907,13 +907,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 	}
 
 	if (extra_cc_nr)
-		strbuf_addstr(&buf, "Cc: ");
 	for (i = 0; i < extra_cc_nr; i++) {
-		if (i)
-			strbuf_addstr(&buf, "    ");
+		strbuf_addstr(&buf, "Cc: ");
 		strbuf_addstr(&buf, extra_cc[i]);
-		if (i + 1 < extra_cc_nr)
-			strbuf_addch(&buf, ',');
 		strbuf_addch(&buf, '\n');
 	}
 
Jay Soffian· Feb 28, 2009, 16:15 UTC · re: Peng Tao · lore

Re: [PATCH] fix git format-patch --cc=<email> format

On Sat, Feb 28, 2009 at 7:42 AM, Peng Tao <bergwolf@gmail.com> wrote:
Show 9 quoted lines
> If there are multiple --cc=<email> arguments, git format-patch will generate
> patches with cc lines like:
>  Cc: <email>,
>      <email>
> which git send-email fails to parse.
> git send-email only accept formats like:
>  Cc: <email>
>  Cc: <email>
> So change git format-patch to generate patches in a proper format.

This is fixed in next, but we fixed send-email instead to handle the messages that format-patch generates, as they should be valid.

j.
Junio C Hamano· Feb 28, 2009, 17:29 UTC · re: Jay Soffian · lore

Re: [PATCH] fix git format-patch --cc=<email> format

Jay Soffian <jaysoffian@gmail.com> writes:
Show 13 quoted lines
> On Sat, Feb 28, 2009 at 7:42 AM, Peng Tao <bergwolf@gmail.com> wrote:
>> If there are multiple --cc=<email> arguments, git format-patch will generate
>> patches with cc lines like:
>>  Cc: <email>,
>>      <email>
>> which git send-email fails to parse.
>> git send-email only accept formats like:
>>  Cc: <email>
>>  Cc: <email>
>> So change git format-patch to generate patches in a proper format.
>
> This is fixed in next, but we fixed send-email instead to handle the
> messages that format-patch generates, as they should be valid.

Per RFC2822 3.6 (pp 19-20), "cc" is to appear at most once (same is true for "to" and "bcc"). I think fix to format-patch is necessary regardless of what send-email does.

Jeff King· Mar 1, 2009, 01:01 UTC · re: Junio C Hamano · lore

Re: [PATCH] fix git format-patch --cc=<email> format

On Sat, Feb 28, 2009 at 09:29:58AM -0800, Junio C Hamano wrote:
Show 16 quoted lines
> >> If there are multiple --cc=<email> arguments, git format-patch will generate
> >> patches with cc lines like:
> >>  Cc: <email>,
> >>      <email>
> >> which git send-email fails to parse.
> >> git send-email only accept formats like:
> >>  Cc: <email>
> >>  Cc: <email>
> >> So change git format-patch to generate patches in a proper format.
> >
> > This is fixed in next, but we fixed send-email instead to handle the
> > messages that format-patch generates, as they should be valid.
> 
> Per RFC2822 3.6 (pp 19-20), "cc" is to appear at most once (same is true
> for "to" and "bcc").  I think fix to format-patch is necessary regardless
> of what send-email does.

Then isn't the current format-patch output (folding the cc over multiple lines) correct, and the patch (outputting multiple cc headers) wrong?

-Peff
Junio C Hamano· Mar 1, 2009, 02:24 UTC · re: Jeff King · lore

Re: [PATCH] fix git format-patch --cc=<email> format

Jeff King <peff@peff.net> writes:
Show 22 quoted lines
> On Sat, Feb 28, 2009 at 09:29:58AM -0800, Junio C Hamano wrote:
>
>> >> If there are multiple --cc=<email> arguments, git format-patch will generate
>> >> patches with cc lines like:
>> >>  Cc: <email>,
>> >>      <email>
>> >> which git send-email fails to parse.
>> >> git send-email only accept formats like:
>> >>  Cc: <email>
>> >>  Cc: <email>
>> >> So change git format-patch to generate patches in a proper format.
>> >
>> > This is fixed in next, but we fixed send-email instead to handle the
>> > messages that format-patch generates, as they should be valid.
>> 
>> Per RFC2822 3.6 (pp 19-20), "cc" is to appear at most once (same is true
>> for "to" and "bcc").  I think fix to format-patch is necessary regardless
>> of what send-email does.
>
> Then isn't the current format-patch output (folding the cc over
> multiple lines) correct, and the patch (outputting multiple cc headers)
> wrong?

Ahh, sorry I misread what the commit message was saying and the patch was doing.

← back to recent threads