Skip to content

Commit 6310071

Browse files
zeldovichgitster
authored andcommitted
git-send-email: treat field names as case-insensitively
Field names like To:, Cc:, etc. are case-insensitive; use a case-insensitive regexp to match them as such. Previously, git-send-email would fail to pick-up the addresses when in-body "fake" headers with different cases (e.g. lowercase "cc:") are manually inserted to the messages it was asked to send, even though the text will still show them. Signed-off-by: Nickolai Zeldovich <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7e20105 commit 6310071

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

git-send-email.perl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,25 +1227,25 @@ sub send_message {
12271227
}
12281228

12291229
if (defined $input_format && $input_format eq 'mbox') {
1230-
if (/^Subject:\s+(.*)$/) {
1230+
if (/^Subject:\s+(.*)$/i) {
12311231
$subject = $1;
12321232
}
1233-
elsif (/^From:\s+(.*)$/) {
1233+
elsif (/^From:\s+(.*)$/i) {
12341234
($author, $author_encoding) = unquote_rfc2047($1);
12351235
next if $suppress_cc{'author'};
12361236
next if $suppress_cc{'self'} and $author eq $sender;
12371237
printf("(mbox) Adding cc: %s from line '%s'\n",
12381238
$1, $_) unless $quiet;
12391239
push @cc, $1;
12401240
}
1241-
elsif (/^To:\s+(.*)$/) {
1241+
elsif (/^To:\s+(.*)$/i) {
12421242
foreach my $addr (parse_address_line($1)) {
12431243
printf("(mbox) Adding to: %s from line '%s'\n",
12441244
$addr, $_) unless $quiet;
12451245
push @to, sanitize_address($addr);
12461246
}
12471247
}
1248-
elsif (/^Cc:\s+(.*)$/) {
1248+
elsif (/^Cc:\s+(.*)$/i) {
12491249
foreach my $addr (parse_address_line($1)) {
12501250
if (unquote_rfc2047($addr) eq $sender) {
12511251
next if ($suppress_cc{'self'});
@@ -1267,7 +1267,7 @@ sub send_message {
12671267
elsif (/^Message-Id: (.*)/i) {
12681268
$message_id = $1;
12691269
}
1270-
elsif (!/^Date:\s/ && /^[-A-Za-z]+:\s+\S/) {
1270+
elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) {
12711271
push @xh, $_;
12721272
}
12731273

0 commit comments

Comments
 (0)