aboutsummaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-10-07 03:09:05 -0700
committerJunio C Hamano <junkio@cox.net>2006-10-07 23:37:15 -0700
commite6b0964af595bbc4dab2a63c17bc4c8064a28073 (patch)
tree0473a5506d21f01cc87636840f19c6b600bcbe5d /git-send-email.perl
parent7a2a0d214169a5d6f22fc62c4ae6a7ca5b27fb3e (diff)
downloadgit-e6b0964af595bbc4dab2a63c17bc4c8064a28073.tar.gz
git-e6b0964af595bbc4dab2a63c17bc4c8064a28073.tar.xz
Make git-send-email detect mbox-style patches more readily
Earlier we insisted that mbox file to begin with "From ". That is fine as long as you feed format-patch output, but if you handcraft the input file, this is unnecessary burden. We should detect lines that look like e-mail headers and say that is also a mbox file. The other input file format is traditional "send lots of email", whose first line would never look like e-mail headers, so this is a safe change. The original patch was done by Matthew Wilcox, which checked explicitly for headers the script pays attention to. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl13
1 files changed, 10 insertions, 3 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 21b3686b2..eb9127089 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -481,15 +481,21 @@ foreach my $t (@files) {
my $author_not_sender = undef;
@cc = @initial_cc;
@xh = ();
- my $found_mbox = 0;
+ my $input_format = undef;
my $header_done = 0;
$message = "";
while(<F>) {
if (!$header_done) {
- $found_mbox = 1, next if (/^From /);
+ if (/^From /) {
+ $input_format = 'mbox';
+ next;
+ }
chomp;
+ if (!defined $input_format && /^[-A-Za-z]+:\s/) {
+ $input_format = 'mbox';
+ }
- if ($found_mbox) {
+ if (defined $input_format && $input_format eq 'mbox') {
if (/^Subject:\s+(.*)$/) {
$subject = $1;
@@ -514,6 +520,7 @@ foreach my $t (@files) {
# line 1 = cc
# line 2 = subject
# So let's support that, too.
+ $input_format = 'lots';
if (@cc == 0) {
printf("(non-mbox) Adding cc: %s from line '%s'\n",
$_, $_) unless $quiet;