Skip to content

Commit

Permalink
git-send-email: treat field names as case-insensitively
Browse files Browse the repository at this point in the history
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 <nickolai@csail.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nickolai Zeldovich authored and Junio C Hamano committed Jan 7, 2013
1 parent 7e20105 commit 6310071
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1227,25 +1227,25 @@ sub send_message {
}

if (defined $input_format && $input_format eq 'mbox') {
if (/^Subject:\s+(.*)$/) {
if (/^Subject:\s+(.*)$/i) {
$subject = $1;
}
elsif (/^From:\s+(.*)$/) {
elsif (/^From:\s+(.*)$/i) {
($author, $author_encoding) = unquote_rfc2047($1);
next if $suppress_cc{'author'};
next if $suppress_cc{'self'} and $author eq $sender;
printf("(mbox) Adding cc: %s from line '%s'\n",
$1, $_) unless $quiet;
push @cc, $1;
}
elsif (/^To:\s+(.*)$/) {
elsif (/^To:\s+(.*)$/i) {
foreach my $addr (parse_address_line($1)) {
printf("(mbox) Adding to: %s from line '%s'\n",
$addr, $_) unless $quiet;
push @to, sanitize_address($addr);
}
}
elsif (/^Cc:\s+(.*)$/) {
elsif (/^Cc:\s+(.*)$/i) {
foreach my $addr (parse_address_line($1)) {
if (unquote_rfc2047($addr) eq $sender) {
next if ($suppress_cc{'self'});
Expand All @@ -1267,7 +1267,7 @@ sub send_message {
elsif (/^Message-Id: (.*)/i) {
$message_id = $1;
}
elsif (!/^Date:\s/ && /^[-A-Za-z]+:\s+\S/) {
elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) {
push @xh, $_;
}

Expand Down

0 comments on commit 6310071

Please sign in to comment.