Skip to content

Commit 9d33439

Browse files
jhovoldgitster
authored andcommitted
send-email: only allow one address per body tag
Adding comments after a tag in the body is a common practise (e.g. in the Linux kernel) and git-send-email has been supporting this for years by removing any trailing cruft after the address. After some recent changes, any trailing comment is now instead appended to the recipient name (with some random white space inserted) resulting in undesirable noise in the headers, for example: CC: "# 3 . 3 . x : 1b9508f : sched : Rate-limit newidle" <[email protected]> Revert to the earlier behaviour of discarding anything after the (first) address in a tag while parsing the body. Note that multiple addresses after are still allowed after a command line switch (and in a CC header field). Also note that --suppress-cc=self was never honoured when using multiple addresses in a tag. Signed-off-by: Johan Hovold <[email protected]> Reviewed-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3b9e3c2 commit 9d33439

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

git-send-email.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ sub send_message {
15451545
# Now parse the message body
15461546
while(<$fh>) {
15471547
$message .= $_;
1548-
if (/^(Signed-off-by|Cc): (.*)$/i) {
1548+
if (/^(Signed-off-by|Cc): ([^>]*>?)/i) {
15491549
chomp;
15501550
my ($what, $c) = ($1, $2);
15511551
chomp $c;

t/t9001-send-email.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ cat >expected-cc <<\EOF
148148
149149
150150
151-
152151
EOF
153152
"
154153

@@ -159,9 +158,9 @@ test_expect_success $PREREQ 'cc trailer with various syntax' '
159158
Test Cc: trailers.
160159
161160
162-
Cc: <[email protected]> # this is part of the name
163-
164-
Cc: "Some # Body" <five@example.com> [part.of.name.too]
161+
Cc: <[email protected]> # trailing comments are ignored
162+
Cc: <[email protected]>, <not.[email protected]> one address per line
163+
Cc: "Some # Body" <four@example.com> [ <also.a.comment> ]
165164
EOF
166165
clean_fake_sendmail &&
167166
git send-email -1 [email protected] \

0 commit comments

Comments
 (0)