summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0d351e9)
raw | patch | inline | side by side (parent: 0d351e9)
author | Junio C Hamano <gitster@pobox.com> | |
Wed, 20 Jun 2007 20:47:34 +0000 (13:47 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 24 Jun 2007 09:46:35 +0000 (02:46 -0700) |
When the original $from address fails to yield a valid-looking
e-mail address, we created a bogus looking message ID, formatted
like this:
Message-Id: <11823357623688-git-send-email->
This commit fixes it by moving call to make_message_id() to
where it matters, namely, before the $message_id is needed to be
placed in the generated e-mail header; this has an important
side effect of making it clear that $from is already available.
Also throw in Sys::Hostname::hostname() just for fun, although I
suspect that the code would never trigger due to the modified
call sequence that makes sure $from is always available. This
is based on a suggestion by Michael Hendricks.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
e-mail address, we created a bogus looking message ID, formatted
like this:
Message-Id: <11823357623688-git-send-email->
This commit fixes it by moving call to make_message_id() to
where it matters, namely, before the $message_id is needed to be
placed in the generated e-mail header; this has an important
side effect of making it clear that $from is already available.
Also throw in Sys::Hostname::hostname() just for fun, although I
suspect that the code would never trigger due to the modified
call sequence that makes sure $from is always available. This
is based on a suggestion by Michael Hendricks.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-send-email.perl | patch | blob | history |
diff --git a/git-send-email.perl b/git-send-email.perl
index 7c0c90bd21bbb009de81aa315bed1c947a32c423..9f75551673acc7a53adb789b16e1d04f273fdf89 100755 (executable)
--- a/git-send-email.perl
+++ b/git-send-email.perl
# 1 second since the last time we were called.
# We'll setup a template for the message id, using the "from" address:
-my $message_id_from = extract_valid_address($from);
-my $message_id_template = "<%s-git-send-email-$message_id_from>";
sub make_message_id
{
my $date = time;
my $pseudo_rand = int (rand(4200));
+ my $du_part;
+ for ($from, $committer, $author) {
+ $du_part = extract_valid_address($_);
+ last if ($du_part ne '');
+ }
+ if ($du_part eq '') {
+ use Sys::Hostname qw();
+ $du_part = 'user@' . Sys::Hostname::hostname();
+ }
+ my $message_id_template = "<%s-git-send-email-$du_part>";
$message_id = sprintf $message_id_template, "$date$pseudo_rand";
#print "new message id = $message_id\n"; # Was useful for debugging
}
$ccline = "\nCc: $cc";
}
$from = sanitize_address_rfc822($from);
+ make_message_id();
+
my $header = "From: $from
To: $to${ccline}
Subject: $subject
$reply_to = $initial_reply_to;
$references = $initial_reply_to || '';
-make_message_id();
$subject = $initial_subject;
foreach my $t (@files) {
$references = "$message_id";
}
}
- make_message_id();
}
if ($compose) {