git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] send-email: more meaningful Message-ID

From
EWEric Wong <normalperson@yhbt.net>
Date
Apr 6, 2016, 20:07 UTC
Message-ID
<20160406200714.GA19315@dcvr.yhbt.net>
In-Reply-To
<20160405213607.GA15023@dcvr.yhbt.net>

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>
---
  v2 - moved "use" to the top
  Thanks to Dscho for addressing Windows comments:
  http://mid.gmane.org/alpine.DEB.2.20.1604061505010.3371@virtualbox
 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..52cf828 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;
@@ -949,7 +950,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++;
@@ -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
 }
-- 
EW
Previous: Johannes Schindelin
Message 5 of 5 in “send-email: more meaningful Message-ID”
  1. send-email: more meaningful Message-IDEric Wong, Apr 5, 2016
  2. Junio C HamanoApr 5, 2016
  3. Eric WongApr 5, 2016
  4. Johannes SchindelinApr 6, 2016
  5. send-email: more meaningful Message-IDEric Wong, Apr 6, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.