Replying to a thread on lkml via git send-email
17 Jun 2014Where cli proves to be the best mail client
This post tells you how to use git send-email’s in-reply-to function to create a threaded reply
I recently had to reply to a thread on the linux kernel mailing list that happened to be posted when I was not subscribed to it. While clients like Thunderbird/Outlook or even Gmail may be smart enough to string conversations together via the subject line or some variation thereof (eg, foo & Re: foo), mailing lists rely on message headers, specifically Message-Id & In-Reply-to.
What this basically means is that if you are sending message B as a reply to message A (thus creating a thread), the value of In-Reply-To field in the message headers of B should be the same as the Message-Id in the message headers of A. Similarly, message C will include the Message-Id of B in the In-Reply-To field when sent as a reply to B. Take a look here for an example of a threaded view.
Now lkml has a fairly strict set of guidelines about how to format email sent to lkml, but it basically boils down no html, text only, no word wrapping and inline patches. If these do not apply to your mailing list, you might want to directly try configuring Thunderbird to support In-Reply-To and skip the rest of this. Note: this did not seem to work on Thunderbird 24. Pretty much none of the email clients I tried (mutt, realpine) seemed to have an easy way to support in-reply-to
If you’re still here stranger, time to get excited about cli !
To get past all these mailing constraints, and because Linus basically wrote Git, git supports the ability to directly send out email that passes all these requirements. Note, git send-email needs perl-MIME-Base64 and perl-Authen-SASL installed. There is also a bug in git send-email(v2.0.0.) that forces encryption even if your smtp server does not require it. Please (temporarily) apply the following patch if your outgoing/relay server does not use encryption
Now, lets takes a sample message to reply to. Let’s presume we want to reply to Linus Torvalds (Please do not actually email Linus for testing purposes). First thing we want to do is fetch the headers for that message, which we can see by clicking [headers]. Specifically, we only need one line
The value inside <…> is the Message-Id we need to reply to create a thread around this message. Next, we create a text file, let’s say msg1 that git can parse as an email draft. You can type out your email here if you like but you really need to have only two lines in there, message body goes below these two lines
Change your email address & subject as required, the ‘Re: ‘ before the subject line is recommended to indicate a reply. Next, run git send-email as follows
To set encryption, use –smtp-encryption ssl or tls. Using any other value disables encryption (but take note of previously mentioned bug). Using the –annotate flag lets you edit the email before it is sent out, simply type out your message below the subject line. If you skip –annotate, git will proceed to send email (but asks for confirmation).
Note, there are some caveats here. Some places like the Indiana University Kernel Mailing List Archives group messages into chunks of 15 days, you won’t be able to see a threaded view unless you reply before that 15 day window expires, but you will still see your reply threaded at places without this restriction, for eg the actual lkml archives
comments powered by Disqus