Skip to contentSkip to conversation

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

PATCH In review Peng Tao 4 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Peng Tao

author
#0 lore raw

PATCH 1/1 fix git format-patch --cc=<email> format

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.

---
 builtin-log.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
builtin-log.c +1 -5
index 60f8dd8..22bb6b6 100644
@@ -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');
 	}
 
#1 lore raw
Quoted 9 lines · Peng Tao

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.

#2 lore raw
Quoted 11 lines · Jay Soffian
Quoted 9 lines · Peng Tao

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.

Quoted 2 lines

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.

#3 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 10 lines
Quoted 9 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.

Quoted 6 lines
Quoted 2 lines

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

#4 lore raw
Quoted 15 lines · Jeff King
Quoted 13 lines · Junio C Hamano
Quoted 12 lines
Quoted 9 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.

Quoted 7 lines
Quoted 3 lines

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.