Browse Source

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>
maint
Junio C Hamano 18 years ago
parent
commit
ce91c2f653
  1. 9
      git-send-email.perl

9
git-send-email.perl

@ -83,7 +83,7 @@ sub cleanup_compose_files();
my $compose_filename = ".msg.$$"; my $compose_filename = ".msg.$$";


# Variables we fill in automatically, or via prompting: # Variables we fill in automatically, or via prompting:
my (@to,@cc,@initial_cc,@bcclist, my (@to,@cc,@initial_cc,@bcclist,@xh,
$initial_reply_to,$initial_subject,@files,$from,$compose,$time); $initial_reply_to,$initial_subject,@files,$from,$compose,$time);


# Behavior modification variables # Behavior modification variables
@ -422,6 +422,9 @@ X-Mailer: git-send-email $gitversion
$header .= "In-Reply-To: $reply_to\n"; $header .= "In-Reply-To: $reply_to\n";
$header .= "References: $references\n"; $header .= "References: $references\n";
} }
if (@xh) {
$header .= join("\n", @xh) . "\n";
}


if ($smtp_server =~ m#^/#) { if ($smtp_server =~ m#^/#) {
my $pid = open my $sm, '|-'; my $pid = open my $sm, '|-';
@ -472,6 +475,7 @@ foreach my $t (@files) {


my $author_not_sender = undef; my $author_not_sender = undef;
@cc = @initial_cc; @cc = @initial_cc;
@xh = ();
my $found_mbox = 0; my $found_mbox = 0;
my $header_done = 0; my $header_done = 0;
$message = ""; $message = "";
@ -495,6 +499,9 @@ foreach my $t (@files) {
$2, $_) unless $quiet; $2, $_) unless $quiet;
push @cc, $2; push @cc, $2;
} }
elsif (/^[-A-Za-z]+:\s+\S/) {
push @xh, $_;
}


} else { } else {
# In the traditional # In the traditional

Loading…
Cancel
Save