{"thread":{"id":"41935","subject":"[PATCH] send-email: more meaningful Message-ID","startedAt":"2016-04-05T19:39:52Z","lastAt":"2016-04-06T20:07:14Z","messageCount":5,"participants":["Eric Wong","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"282728","messageId":"20160405193952.5849-1-normalperson@yhbt.net","threadId":"41935","inReplyTo":null,"subject":"[PATCH] send-email: more meaningful Message-ID","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2016-04-05T19:39:52Z","receivedAt":"2016-04-05T19:39:52Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Using a YYYYmmddHHMMSS date representation is more meaningful to\nhumans, especially when used for lookups on NNTP servers or linking\nto archive sites via Message-ID (e.g. mid.gmane.org or\nmid.mail-archive.com).  This timestamp format more easily gives a\nreader of the URL itself a rough date of a linked message compared\nto having them calculate the seconds since the Unix epoch.\n\nFurthermore, having the MUA name in the Message-ID seems to be a\nrare oddity I haven't noticed outside of git-send-email.  We\nalready have an optional X-Mailer header field to advertise for\nus, so extending the Message-ID by 15 characters can make for\nunpleasant Message-ID-based URLs to archive sites.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-send-email.perl | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex d356901..23141e7 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -949,7 +949,8 @@ my ($message_id_stamp, $message_id_serial);\n sub make_message_id {\n \tmy $uniq;\n \tif (!defined $message_id_stamp) {\n-\t\t$message_id_stamp = sprintf(\"%s-%s\", time, $$);\n+\t\tuse POSIX qw/strftime/;\n+\t\t$message_id_stamp = strftime(\"%Y%m%d%H%M%S.$$\", gmtime(time));\n \t\t$message_id_serial = 0;\n \t}\n \t$message_id_serial++;\n@@ -964,7 +965,7 @@ sub make_message_id {\n \t\trequire Sys::Hostname;\n \t\t$du_part = 'user@' . Sys::Hostname::hostname();\n \t}\n-\tmy $message_id_template = \"<%s-git-send-email-%s>\";\n+\tmy $message_id_template = \"<%s-%s>\";\n \t$message_id = sprintf($message_id_template, $uniq, $du_part);\n \t#print \"new message id = $message_id\\n\"; # Was useful for debugging\n }\n-- \nEW\n"},{"id":"282734","messageId":"xmqqinzv224x.fsf@gitster.mtv.corp.google.com","threadId":"41935","inReplyTo":"20160405193952.5849-1-normalperson@yhbt.net","subject":"Re: [PATCH] send-email: more meaningful Message-ID","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-04-05T21:10:06Z","receivedAt":"2016-04-05T21:10:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> Using a YYYYmmddHHMMSS date representation is more meaningful to\n> humans, especially when used for lookups on NNTP servers or linking\n> to archive sites via Message-ID (e.g. mid.gmane.org or\n> mid.mail-archive.com).  This timestamp format more easily gives a\n> reader of the URL itself a rough date of a linked message compared\n> to having them calculate the seconds since the Unix epoch.\n>\n> Furthermore, having the MUA name in the Message-ID seems to be a\n> rare oddity I haven't noticed outside of git-send-email.  We\n> already have an optional X-Mailer header field to advertise for\n> us, so extending the Message-ID by 15 characters can make for\n> unpleasant Message-ID-based URLs to archive sites.\n>\n> Signed-off-by: Eric Wong <normalperson@yhbt.net>\n> ---\n\nSounds like a sensible goal.  Just a few comments.\n\n - Is it safe to assume that we always can use POSIX::strftime(), or\n   do we need some fallback?  I am guessing that this is safe, as\n   POSIX has been part of the core modules for a long time, and the\n   script does \"use 5.008\" upfront.\n\n - It is my understanding that, as \"use\" is a compilation-time\n   thing, hiding it inside a block does not help reducing the\n   start-up overhead (people can use \"require\" if they want to do a\n   lazy loading and optionally a fallback).  Is my Perl5 outdated?\n   Otherwise, let's have it near the beginning of the script, close\n   to where we use Term::ReadLine and others.\n\nThanks.\n\n>  git-send-email.perl | 5 +++--\n>  1 file changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index d356901..23141e7 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -949,7 +949,8 @@ my ($message_id_stamp, $message_id_serial);\n>  sub make_message_id {\n>  \tmy $uniq;\n>  \tif (!defined $message_id_stamp) {\n> -\t\t$message_id_stamp = sprintf(\"%s-%s\", time, $$);\n> +\t\tuse POSIX qw/strftime/;\n> +\t\t$message_id_stamp = strftime(\"%Y%m%d%H%M%S.$$\", gmtime(time));\n>  \t\t$message_id_serial = 0;\n>  \t}\n>  \t$message_id_serial++;\n> @@ -964,7 +965,7 @@ sub make_message_id {\n>  \t\trequire Sys::Hostname;\n>  \t\t$du_part = 'user@' . Sys::Hostname::hostname();\n>  \t}\n> -\tmy $message_id_template = \"<%s-git-send-email-%s>\";\n> +\tmy $message_id_template = \"<%s-%s>\";\n>  \t$message_id = sprintf($message_id_template, $uniq, $du_part);\n>  \t#print \"new message id = $message_id\\n\"; # Was useful for debugging\n>  }\n"},{"id":"282736","messageId":"20160405213607.GA15023@dcvr.yhbt.net","threadId":"41935","inReplyTo":"xmqqinzv224x.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] send-email: more meaningful Message-ID","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2016-04-05T21:36:07Z","receivedAt":"2016-04-05T21:36:07Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n> \n> > Using a YYYYmmddHHMMSS date representation is more meaningful to\n> > humans, especially when used for lookups on NNTP servers or linking\n> > to archive sites via Message-ID (e.g. mid.gmane.org or\n> > mid.mail-archive.com).  This timestamp format more easily gives a\n> > reader of the URL itself a rough date of a linked message compared\n> > to having them calculate the seconds since the Unix epoch.\n> >\n> > Furthermore, having the MUA name in the Message-ID seems to be a\n> > rare oddity I haven't noticed outside of git-send-email.  We\n> > already have an optional X-Mailer header field to advertise for\n> > us, so extending the Message-ID by 15 characters can make for\n> > unpleasant Message-ID-based URLs to archive sites.\n> >\n> > Signed-off-by: Eric Wong <normalperson@yhbt.net>\n> > ---\n> \n> Sounds like a sensible goal.  Just a few comments.\n> \n>  - Is it safe to assume that we always can use POSIX::strftime(), or\n>    do we need some fallback?  I am guessing that this is safe, as\n>    POSIX has been part of the core modules for a long time, and the\n>    script does \"use 5.008\" upfront.\n\nI'm hoping so :)  And none of the format specifiers used here\nshould be subject to locale-dependent weirdness, at least.\n\n+Cc both Johannes for Windows knowledge.\n\n>  - It is my understanding that, as \"use\" is a compilation-time\n>    thing, hiding it inside a block does not help reducing the\n>    start-up overhead (people can use \"require\" if they want to do a\n>    lazy loading and optionally a fallback).  Is my Perl5 outdated?\n>    Otherwise, let's have it near the beginning of the script, close\n>    to where we use Term::ReadLine and others.\n\nYou're correct, I'll move the \"use\" to the top in v2.\n\nI could call \"require\" and call the sub as \"POSIX::strftime\",\nbut this code path is likely enough that any startup time\nimprovement for uncommon cases wouldn't be worth it.\n\nWill wait a bit for strftime portability comments before v2.\n\n> > --- a/git-send-email.perl\n> > +++ b/git-send-email.perl\n> > @@ -949,7 +949,8 @@ my ($message_id_stamp, $message_id_serial);\n> >  sub make_message_id {\n> >  \tmy $uniq;\n> >  \tif (!defined $message_id_stamp) {\n> > -\t\t$message_id_stamp = sprintf(\"%s-%s\", time, $$);\n> > +\t\tuse POSIX qw/strftime/;\n> > +\t\t$message_id_stamp = strftime(\"%Y%m%d%H%M%S.$$\", gmtime(time));\n> >  \t\t$message_id_serial = 0;\n> >  \t}\n> >  \t$message_id_serial++;\n"},{"id":"282762","messageId":"alpine.DEB.2.20.1604061505010.3371@virtualbox","threadId":"41935","inReplyTo":"20160405213607.GA15023@dcvr.yhbt.net","subject":"Re: [PATCH] send-email: more meaningful Message-ID","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-04-06T13:08:14Z","receivedAt":"2016-04-06T13:08:14Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 5 Apr 2016, Eric Wong wrote:\n\n> Junio C Hamano <gitster@pobox.com> wrote:\n> > Eric Wong <normalperson@yhbt.net> writes:\n> > \n> > > Using a YYYYmmddHHMMSS date representation is more meaningful to\n> > > humans, especially when used for lookups on NNTP servers or linking\n> > > to archive sites via Message-ID (e.g. mid.gmane.org or\n> > > mid.mail-archive.com).  This timestamp format more easily gives a\n> > > reader of the URL itself a rough date of a linked message compared\n> > > to having them calculate the seconds since the Unix epoch.\n> > >\n> > > Furthermore, having the MUA name in the Message-ID seems to be a\n> > > rare oddity I haven't noticed outside of git-send-email.  We\n> > > already have an optional X-Mailer header field to advertise for\n> > > us, so extending the Message-ID by 15 characters can make for\n> > > unpleasant Message-ID-based URLs to archive sites.\n> > >\n> > > Signed-off-by: Eric Wong <normalperson@yhbt.net>\n> > > ---\n> > \n> > Sounds like a sensible goal.  Just a few comments.\n> > \n> >  - Is it safe to assume that we always can use POSIX::strftime(), or\n> >    do we need some fallback?  I am guessing that this is safe, as\n> >    POSIX has been part of the core modules for a long time, and the\n> >    script does \"use 5.008\" upfront.\n> \n> I'm hoping so :)  And none of the format specifiers used here\n> should be subject to locale-dependent weirdness, at least.\n> \n> +Cc both Johannes for Windows knowledge.\n\nThanks.\n\nsend-email is implemented as a Perl script, and Git for Windows uses a\nPerl interpreter for such scripts which uses MSYS2's POSIX emulation\nlayer, i.e. POSIX calls are fine.\n\nShort answer: no problem there, not even on Windows.\n\nOf course, Git for Windows users are much more likely to use a Pull\nRequest based workflow than a mail-based one, so it is even less of a\nproblem for us.\n\nCiao,\nDscho\n"},{"id":"282789","messageId":"20160406200714.GA19315@dcvr.yhbt.net","threadId":"41935","inReplyTo":"20160405213607.GA15023@dcvr.yhbt.net","subject":"[PATCH v2] send-email: more meaningful Message-ID","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2016-04-06T20:07:14Z","receivedAt":"2016-04-06T20:07:14Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Using a YYYYmmddHHMMSS date representation is more meaningful to\nhumans, especially when used for lookups on NNTP servers or linking\nto archive sites via Message-ID (e.g. mid.gmane.org or\nmid.mail-archive.com).  This timestamp format more easily gives a\nreader of the URL itself a rough date of a linked message compared\nto having them calculate the seconds since the Unix epoch.\n\nFurthermore, having the MUA name in the Message-ID seems to be a\nrare oddity I haven't noticed outside of git-send-email.  We\nalready have an optional X-Mailer header field to advertise for\nus, so extending the Message-ID by 15 characters can make for\nunpleasant Message-ID-based URLs to archive sites.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n  v2 - moved \"use\" to the top\n  Thanks to Dscho for addressing Windows comments:\n  http://mid.gmane.org/alpine.DEB.2.20.1604061505010.3371@virtualbox\n\n git-send-email.perl | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex d356901..52cf828 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -19,6 +19,7 @@\n use 5.008;\n use strict;\n use warnings;\n+use POSIX qw/strftime/;\n use Term::ReadLine;\n use Getopt::Long;\n use Text::ParseWords;\n@@ -949,7 +950,7 @@ my ($message_id_stamp, $message_id_serial);\n sub make_message_id {\n \tmy $uniq;\n \tif (!defined $message_id_stamp) {\n-\t\t$message_id_stamp = sprintf(\"%s-%s\", time, $$);\n+\t\t$message_id_stamp = strftime(\"%Y%m%d%H%M%S.$$\", gmtime(time));\n \t\t$message_id_serial = 0;\n \t}\n \t$message_id_serial++;\n@@ -964,7 +965,7 @@ sub make_message_id {\n \t\trequire Sys::Hostname;\n \t\t$du_part = 'user@' . Sys::Hostname::hostname();\n \t}\n-\tmy $message_id_template = \"<%s-git-send-email-%s>\";\n+\tmy $message_id_template = \"<%s-%s>\";\n \t$message_id = sprintf($message_id_template, $uniq, $du_part);\n \t#print \"new message id = $message_id\\n\"; # Was useful for debugging\n }\n-- \nEW\n"}]}