diff options
author | Kyle Meyer <kyle@kyleam.com> | 2023-04-30 18:15:50 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2023-04-30 20:26:40 -0400 |
commit | 9d764049a83cbc8519792760ea8807aec5e0f6ac (patch) | |
tree | 542032608d357517302c097bbe2b2979e806cf62 | |
parent | 2c37ca5e9a1b5f63e4cfe24c221602cf2eb03e0e (diff) | |
download | piem-9d764049a83cbc8519792760ea8807aec5e0f6ac.tar.gz |
piem-am-ready-mbox: Adjust header regex for format-patch change
As of git.git's ba4324c4e1 (e-mail workflow: Message-ID is spelled
with ID in both capital letters, 2023-04-03), git-format-patch inserts
a Message-ID header instead of Message-Id. Teach
piem--insert-message-id-header to look for either variant when it
checks for an existing header.
Another option would be to ignore the header case entirely. However,
piem--insert-message-id-header is intended to work only for
format-patch output, so stick with the stricter header matching.
Message-ID: <20230430221552.251335-3-kyle@kyleam.com>
-rw-r--r-- | piem.el | 5 | ||||
-rw-r--r-- | tests/piem-tests.el | 18 |
2 files changed, 22 insertions, 1 deletions
@@ -601,8 +601,11 @@ public-inbox's configuration), return the value of (rx line-start (zero-or-one space) line-end)))) (cond ((looking-at-p + ;; git-format-patch switched to "Message-ID" spelling + ;; in v2.41. (rx line-start - "Message-Id: <" (one-or-more not-newline) ">" + "Message-" (or "Id" "ID") + ": <" (one-or-more not-newline) ">" line-end)) (throw 'has-message-id nil)) ((looking-at-p diff --git a/tests/piem-tests.el b/tests/piem-tests.el index 79d8591..6f39a53 100644 --- a/tests/piem-tests.el +++ b/tests/piem-tests.el @@ -179,6 +179,24 @@ (should-not (with-temp-buffer (piem--insert-message-id-header "msg@id"))) + (should-not + (string-match-p + "Message-Id: <msg@id>" + (with-temp-buffer + (insert "\ +From 0d732713af1f3fb48b37430e2cd0a3033cea14f3 Mon Sep 17 00:00:00 2001 +From: Foo Bar <f@example.com> +Message-ID: <existing@id> +Date: Fri, 22 Jan 2021 22:35:58 -0500 +Subject: [PATCH] a + +--- + a | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 a") + (goto-char (point-min)) + (piem--insert-message-id-header "msg@id") + (buffer-string)))) (should (string-match-p (concat |