send-email: Identify author at the top when sending e-mail
git-send-email did not check if the sender is the same as the patch author. Follow the "From: at the beginning" convention to propagate the patch author correctly. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Mar 23, 2006 at 23:43 UTC
8a8e623514d79f006d9b83c47248435f20d4be2a
1 file changed
+10
-1
git-send-email.perl
+10
-1
@@ -307,6 +307,7 @@ $subject = $initial_subject;
307
foreach my $t (@files) {
308
open(F,"<",$t) or die "can't open file $t";
309
310
+ my $author_not_sender = undef;
311
@cc = @initial_cc;
312
my $found_mbox = 0;
313
my $header_done = 0;
@@ -321,7 +322,12 @@ foreach my $t (@files) {
322
$subject = $1;
323
324
} elsif (/^(Cc|From):\s+(.*)$/) {
324
- next if ($2 eq $from && $suppress_from);
325
+ if ($2 eq $from) {
326
+ next if ($suppress_from);
327
+ }
328
+ else {
329
+ $author_not_sender = $2;
330
+ }
331
printf("(mbox) Adding cc: %s from line '%s'\n",
332
$2, $_) unless $quiet;
333
push @cc, $2;
@@ -360,6 +366,9 @@ foreach my $t (@files) {
366
}
367
}
368
close F;
369
+ if (defined $author_not_sender) {
370
+ $message = "From: $author_not_sender\n\n$message";
371
+ }
372
373
$cc = join(", ", unique_email_list(@cc));
374