From: David Bremner <david@tethera.net>
To: Damien Cassou <damien@cassou.me>, notmuch@notmuchmail.org
Subject: Re: [PATCH] Fix notmuch-mua.el notmuch-mua-mail
Date: Thu, 02 Jun 2022 08:12:40 -0300 [thread overview]
Message-ID: <87h753z5cn.fsf@tethera.net> (raw)
In-Reply-To: <87v8tk17ix.fsf@cassou.me>
[-- Attachment #1: Type: text/plain, Size: 1655 bytes --]
Damien Cassou <damien@cassou.me> writes:
> Hi David,
>
> Can you please explain me what in git-send-email makes it easier to
> apply the patches? I'm also interested in your process to apply
> patches from your mua (notmuch in Emacs hopefully) to your git
> repository.
There are some convenient tools for applying patches from notmuch in
Sean Whitton's mailscripts collection [1]. I tend to work in the shell
with some git aliases.
[alias]
nmam = "!f() { notmuch extract-patch $1 | git am -; }; f"
[alias]
nmam8 = "!f() { notmuch extract-patch $1 | email-to-8bit | git am -; }; f"
[alias]
nmam3 = "!f() { notmuch extract-patch $1 | git am -3 -; }; f"
I use "c i" to copy the message id, and then paste it into a command
line
$ git nmam <paste id here>
email-to-8bit is a little hack to work around mailman induced damage to
patches; it seems less needed with new versions of git.
notmuch-extract-patch is from mailscripts, and it fails (well, fails to
extract any patch) with attached
patches. I used to use
notmuch show --format=raw
in place of "notmuch extract-patch". This succeeds in extracting a
patch, but smashes the body text together with the commit message in the
resulting commit.
>> [ about emacs git commit messages ]
> I think it focuses too much on what has changed
> (something that could be inferred from the patch with a little tooling)
> instead of why the code has changed this way (something only the author
> can tell).
Exactly.
[1]: https://git.spwhitton.name/mailscripts
also available in e.g. Debian.
[-- Attachment #2: email-to-8bit --]
[-- Type: application/octet-stream, Size: 667 bytes --]
#!/usr/bin/env python3
import sys
import email
import email.policy
import logging
from email.charset import Charset
from email.message import EmailMessage
def main():
msg = email.message_from_file(sys.stdin,policy=email.policy.default)
if isinstance(msg, EmailMessage):
body = msg.get_payload(decode=True).decode(encoding='utf8')
msg.replace_header('Content-Transfer-Encoding','8bit')
for field in msg.keys():
print("{:s}: {:s}".format(field,msg[field]))
print("")
print(body.replace('\r\n','\n'))
else:
logging.error('Input was not an e-mail message')
if __name__ == '__main__':
main()
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2022-06-02 11:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-22 7:08 [PATCH] Fix notmuch-mua.el notmuch-mua-mail Damien Cassou
2022-05-23 6:21 ` Damien Cassou
2022-06-01 9:49 ` David Bremner
2022-06-01 19:57 ` Damien Cassou
2022-06-02 11:12 ` David Bremner [this message]
2022-06-02 12:53 ` Damien Cassou
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h753z5cn.fsf@tethera.net \
--to=david@tethera.net \
--cc=damien@cassou.me \
--cc=notmuch@notmuchmail.org \
/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.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
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 read-only IMAP folder(s) and NNTP newsgroup(s).