X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=git-send-email.perl;h=71ba44d69d24bebe26efeada8ec45e23c8b4ee4e;hb=0706bd19ef9b41e7519df2c73796ef93484272fd;hp=29b1105c4c3c83258ebdf53c8885f767baa0ace0;hpb=5a4d707a6d914fcea302e299fc18892d9e42c767;p=git.git diff --git a/git-send-email.perl b/git-send-email.perl index 29b1105c4..71ba44d69 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -317,7 +317,7 @@ if ($suppress_cc{'all'}) { # If explicit old-style ones are specified, they trump --suppress-cc. $suppress_cc{'self'} = $suppress_from if defined $suppress_from; -$suppress_cc{'sob'} = $signed_off_cc if defined $signed_off_cc; +$suppress_cc{'sob'} = !$signed_off_cc if defined $signed_off_cc; # Debugging, print out the suppressions. if (0) { @@ -518,8 +518,22 @@ EOT open(C,"<",$compose_filename) or die "Failed to open $compose_filename : " . $!; + my $need_8bit_cte = file_has_nonascii($compose_filename); + my $in_body = 0; while() { next if m/^GIT: /; + if (!$in_body && /^\n$/) { + $in_body = 1; + if ($need_8bit_cte) { + print C2 "MIME-Version: 1.0\n", + "Content-Type: text/plain; ", + "charset=utf-8\n", + "Content-Transfer-Encoding: 8bit\n"; + } + } + if (!$in_body && /^MIME-Version:/i) { + $need_8bit_cte = 0; + } print C2 $_; } close(C); @@ -855,6 +869,7 @@ foreach my $t (@files) { $message .= $_; if (/^(Signed-off-by|Cc): (.*)$/i) { next if ($suppress_cc{'sob'}); + chomp; my $c = $2; chomp $c; next if ($c eq $sender and $suppress_cc{'self'}); @@ -955,3 +970,13 @@ sub validate_patch { } return undef; } + +sub file_has_nonascii { + my $fn = shift; + open(my $fh, '<', $fn) + or die "unable to open $fn: $!\n"; + while (my $line = <$fh>) { + return 1 if $line =~ /[^[:ascii:]]/; + } + return 0; +}