From 4670e574a5253811b5f7a8f42a68873ac5c45008 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Sun, 25 Jul 2021 17:26:12 +0200 Subject: content: Add new post: "git-am(1) and mail sorting" --- content/9/index.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 content/9/index.md (limited to 'content') diff --git a/content/9/index.md b/content/9/index.md new file mode 100644 index 0000000..f22ed61 --- /dev/null +++ b/content/9/index.md @@ -0,0 +1,35 @@ ++++ +date = 2021-07-25T16:58:29+02:00 +title = "git-am(1) and mail sorting" + +[taxonomies] +tags = ["git", "TIL"] + +[extra] +mentions = [8] ++++ + +In the {{ ref(id=8, text="previous post") }} I talked about a couple of +different ways to apply patches with `mutt(1)` or `neomutt(1)`. Turns out +`Maildir` might not be the best format to use for `git-am(1)` because its +files are not guaranteed to be in any specific order (per +[spec](https://cr.yp.to/proto/maildir.html) they need only carry unique names). + +As `git-am(1)` does not sort its input, patches might be applied in the wrong +order. This came up on the mailing list as well, all the way +[back in 2013](https://public-inbox.org/git/20130301222018.GA839@WST420/). +A fix specific to `Maildir` files created by `mutt(1)` was added in +[`18505c3`](https://github.com/git/git/commit/18505c34237d3544729c3deed3e4f851fb672086). + +Sadly `neomutt(1)` changed this format 5 years ago, removing the sequence number +that `git-am(1)` relies on in commit +[`75b3708`](https://github.com/neomutt/neomutt/commit/75b3708edb18815935692c60bbae56d5301f8210#diff-8904141e55cf466b09a2db0df752f92a29daf093e79df61121ecd347b7631c19L1489-L1491) +and replacing it with a call to `mutt_rand64()`. I can only assume no one is +using `neomutt(1)` to export patches to `Maildir`, since having patches applied +in the wrong order is a pretty significant problem. + +For now I recommend using the `mbox` format instead when exporting patches. +Whilst that doesn't guarantee a specific order either, usually mail clients are +nice enough to export mails to `mbox` in the order they are shown. + +The core issue remains until `git-am(1)` learns to sort mails itself. -- cgit v1.2.3-2-gb3c3