summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2016-04-06 20:07:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-04-06 20:16:09 (GMT)
commitf916ab0ccc1fbeee5a63ec29246ba99df7ff256f (patch)
treee5f53c5e581399569da07889b87caf067093ec2d /git-send-email.perl
parent765428699a5381f113d19974720bc91b5bfeaf1d (diff)
downloadgit-f916ab0ccc1fbeee5a63ec29246ba99df7ff256f.zip
git-f916ab0ccc1fbeee5a63ec29246ba99df7ff256f.tar.gz
git-f916ab0ccc1fbeee5a63ec29246ba99df7ff256f.tar.bz2
send-email: more meaningful Message-ID
Using a YYYYmmddHHMMSS date representation is more meaningful to humans, especially when used for lookups on NNTP servers or linking to archive sites via Message-ID (e.g. mid.gmane.org or mid.mail-archive.com). This timestamp format more easily gives a reader of the URL itself a rough date of a linked message compared to having them calculate the seconds since the Unix epoch. Furthermore, having the MUA name in the Message-ID seems to be a rare oddity I haven't noticed outside of git-send-email. We already have an optional X-Mailer header field to advertise for us, so extending the Message-ID by 15 characters can make for unpleasant Message-ID-based URLs to archive sites. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index e1e9b14..61dbf30 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -19,6 +19,7 @@
use 5.008;
use strict;
use warnings;
+use POSIX qw/strftime/;
use Term::ReadLine;
use Getopt::Long;
use Text::ParseWords;
@@ -910,7 +911,7 @@ my ($message_id_stamp, $message_id_serial);
sub make_message_id {
my $uniq;
if (!defined $message_id_stamp) {
- $message_id_stamp = sprintf("%s-%s", time, $$);
+ $message_id_stamp = strftime("%Y%m%d%H%M%S.$$", gmtime(time));
$message_id_serial = 0;
}
$message_id_serial++;
@@ -925,7 +926,7 @@ sub make_message_id {
require Sys::Hostname;
$du_part = 'user@' . Sys::Hostname::hostname();
}
- my $message_id_template = "<%s-git-send-email-%s>";
+ my $message_id_template = "<%s-%s>";
$message_id = sprintf($message_id_template, $uniq, $du_part);
#print "new message id = $message_id\n"; # Was useful for debugging
}