From: Junio C Hamano <gitster@pobox.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] send-email: more meaningful Message-ID
Date: Tue, 05 Apr 2016 14:10:06 -0700 [thread overview]
Message-ID: <xmqqinzv224x.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160405193952.5849-1-normalperson@yhbt.net> (Eric Wong's message of "Tue, 5 Apr 2016 19:39:52 +0000")
Eric Wong <normalperson@yhbt.net> writes:
> 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>
> ---
Sounds like a sensible goal. Just a few comments.
- Is it safe to assume that we always can use POSIX::strftime(), or
do we need some fallback? I am guessing that this is safe, as
POSIX has been part of the core modules for a long time, and the
script does "use 5.008" upfront.
- It is my understanding that, as "use" is a compilation-time
thing, hiding it inside a block does not help reducing the
start-up overhead (people can use "require" if they want to do a
lazy loading and optionally a fallback). Is my Perl5 outdated?
Otherwise, let's have it near the beginning of the script, close
to where we use Term::ReadLine and others.
Thanks.
> git-send-email.perl | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index d356901..23141e7 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -949,7 +949,8 @@ 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, $$);
> + use POSIX qw/strftime/;
> + $message_id_stamp = strftime("%Y%m%d%H%M%S.$$", gmtime(time));
> $message_id_serial = 0;
> }
> $message_id_serial++;
> @@ -964,7 +965,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
> }
next prev parent reply other threads:[~2016-04-05 21:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 19:39 [PATCH] send-email: more meaningful Message-ID Eric Wong
2016-04-05 21:10 ` Junio C Hamano [this message]
2016-04-05 21:36 ` Eric Wong
2016-04-06 13:08 ` Johannes Schindelin
2016-04-06 20:07 ` [PATCH v2] " Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqinzv224x.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=normalperson@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).