Skip to content

Commit f4c6a0e

Browse files
committed
Merge branch 'cb/send-email-sanitize-trailer-addresses'
Address-looking strings found on the trailer are now placed on the Cc: list after running through sanitize_address by "git send-email". * cb/send-email-sanitize-trailer-addresses: git-send-email: use sanitized address when reading mbox body
2 parents ffc8f11 + c852531 commit f4c6a0e

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

git-send-email.perl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,9 +1847,9 @@ sub pre_process_file {
18471847
$what, $_) unless $quiet;
18481848
next;
18491849
}
1850-
push @cc, $c;
1850+
push @cc, $sc;
18511851
printf(__("(body) Adding cc: %s from line '%s'\n"),
1852-
$c, $_) unless $quiet;
1852+
$sc, $_) unless $quiet;
18531853
}
18541854
}
18551855
close $fh;

t/t9001-send-email.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,49 @@ test_expect_success $PREREQ 'utf8 sender is not duplicated' '
12991299
test_line_count = 1 msgfrom
13001300
'
13011301

1302+
test_expect_success $PREREQ 'setup expect for cc list' "
1303+
cat >expected-cc <<\EOF
1304+
1305+
1306+
1307+
1308+
1309+
1310+
1311+
1312+
EOF
1313+
"
1314+
1315+
test_expect_success $PREREQ 'cc list is sanitized' '
1316+
clean_fake_sendmail &&
1317+
test_commit weird_cc_body &&
1318+
test_when_finished "git reset --hard HEAD^" &&
1319+
git commit --amend -F - <<-EOF &&
1320+
Test Cc: sanitization.
1321+
1322+
Cc: Person, One <[email protected]>
1323+
Cc: Ronnie O${SQ}Sullivan <[email protected]>
1324+
Reviewed-by: Füñný Nâmé <[email protected]>
1325+
Reported-by: bugger on Jira
1326+
Reported-by: Douglas Reporter <[email protected]> [from Jira profile]
1327+
BugID: 12345
1328+
Co-developed-by: "C. O. Developer" <[email protected]>
1329+
Signed-off-by: A. U. Thor <[email protected]>
1330+
EOF
1331+
git send-email -1 [email protected] \
1332+
--smtp-server="$(pwd)/fake.sendmail" >actual-show-all-headers &&
1333+
test_cmp expected-cc commandline1 &&
1334+
test_grep "^(body) Adding cc: \"Person, One\" <[email protected]>" actual-show-all-headers &&
1335+
test_grep "^(body) Adding cc: Ronnie O${SQ}Sullivan <[email protected]>" actual-show-all-headers &&
1336+
test_grep "^(body) Adding cc: =?UTF-8?q?F=C3=BC=C3=B1n=C3=BD=20N=C3=A2m=C3=A9?="\
1337+
" <[email protected]>" actual-show-all-headers &&
1338+
test_grep "^(body) Ignoring Reported-by .* bugger on Jira" actual-show-all-headers &&
1339+
test_grep "^(body) Adding cc: Douglas Reporter <[email protected]>" actual-show-all-headers &&
1340+
test_grep ! "12345" actual-show-all-headers &&
1341+
test_grep "^(body) Adding cc: \"C. O. Developer\" <[email protected]>" actual-show-all-headers &&
1342+
test_grep "^(body) Adding cc: \"A. U. Thor\" <[email protected]>" actual-show-all-headers
1343+
'
1344+
13021345
test_expect_success $PREREQ 'sendemail.composeencoding works' '
13031346
clean_fake_sendmail &&
13041347
git config sendemail.composeencoding iso-8859-1 &&

0 commit comments

Comments
 (0)