git-send-email: do not drop custom headers the user prepared
The command picked up only Subject, CC, and From headers in the incoming mbox text. Sending out patches prepared by git-format-patch with user's custom headers was impossible with that. Just keep the ones it does not need to look at and add them to the header of the message when sending it out. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Oct 5, 2006 at 16:36 UTC
ce91c2f6538fc4a905882f2a7a57d814d82b13e8
1 file changed
+8
-1
git-send-email.perl
+8
-1
@@ -83,7 +83,7 @@ sub cleanup_compose_files();
83
my $compose_filename = ".msg.$$";
84
85
# Variables we fill in automatically, or via prompting:
86
-my (@to,@cc,@initial_cc,@bcclist,
86
+my (@to,@cc,@initial_cc,@bcclist,@xh,
87
$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
88
89
# Behavior modification variables
@@ -422,6 +422,9 @@ X-Mailer: git-send-email $gitversion
422
$header .= "In-Reply-To: $reply_to\n";
423
$header .= "References: $references\n";
424
}
425
+ if (@xh) {
426
+ $header .= join("\n", @xh) . "\n";
427
+ }
428
429
if ($smtp_server =~ m#^/#) {
430
my $pid = open my $sm, '|-';
@@ -472,6 +475,7 @@ foreach my $t (@files) {
475
476
my $author_not_sender = undef;
477
@cc = @initial_cc;
478
+ @xh = ();
479
my $found_mbox = 0;
480
my $header_done = 0;
481
$message = "";
@@ -495,6 +499,9 @@ foreach my $t (@files) {
499
$2, $_) unless $quiet;
500
push @cc, $2;
501
}
502
+ elsif (/^[-A-Za-z]+:\s+\S/) {
503
+ push @xh, $_;
504
+ }
505
506
} else {
507
# In the traditional