* [PATCH 0/4] Update for Git's Message-Id to Message-ID switch
@ 2023-04-30 22:15 Kyle Meyer
2023-04-30 22:15 ` [PATCH 1/4] piem-b4-am-from-mid: Tweak docstring for consistency Kyle Meyer
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Kyle Meyer @ 2023-04-30 22:15 UTC (permalink / raw)
To: piem
git.git's ba4324c4e1 (e-mail workflow: Message-ID is spelled with ID
in both capital letters, 2023-04-03) has been merged to master. With
that change, format-patch will insert a Message-ID header instead of
Message-Id.
This series prepares for those changes. The only patch that
functionally matters is patch 2, which teaches piem-am-ready-mbox's
opt-in "insert message ID header" feature to look for either spelling
when checking whether it should _not_ insert a message ID because one
already exists.
[1/4] piem-b4-am-from-mid: Tweak docstring for consistency
[2/4] piem-am-ready-mbox: Adjust header regex for format-patch change
[3/4] piem-am-ready-mbox: Change spelling of inserted message ID header
[4/4] Switch remaining Message-Id headers to Message-ID
piem-b4.el | 2 +-
piem.el | 13 ++++++++-----
tests/piem-rmail-tests.el | 2 +-
tests/piem-tests.el | 22 ++++++++++++++++++++--
4 files changed, 30 insertions(+), 9 deletions(-)
base-commit: d78900f06615e247cee5472beca4e7ae164fe77f
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] piem-b4-am-from-mid: Tweak docstring for consistency
2023-04-30 22:15 [PATCH 0/4] Update for Git's Message-Id to Message-ID switch Kyle Meyer
@ 2023-04-30 22:15 ` Kyle Meyer
2023-04-30 22:15 ` [PATCH 2/4] piem-am-ready-mbox: Adjust header regex for format-patch change Kyle Meyer
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Kyle Meyer @ 2023-04-30 22:15 UTC (permalink / raw)
To: piem
MID is used throughout the code base, and what it refers to is
probably clear enough without putting "Message-Id" in front of it.
(If it were to stay, it should probably be spelled "message ID").
---
piem-b4.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/piem-b4.el b/piem-b4.el
index 8cbfc35a..cd19ebb3 100644
--- a/piem-b4.el
+++ b/piem-b4.el
@@ -131,7 +131,7 @@ (defun piem-b4-am-ready-from-mid (mid &optional args)
(defun piem-b4-am-from-mid (mid &optional args toggle-worktree)
"Get the thread for MID, extract an am-ready mbox, and apply it.
-Try to generate a thread for the Message-Id MID with
+Try to generate a thread for MID with
`piem-mid-to-thread-functions'. If that fails, try to download
the thread from an inbox URL associated with the current buffer,
provided that the current buffer's message ID matches MID. And
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] piem-am-ready-mbox: Adjust header regex for format-patch change
2023-04-30 22:15 [PATCH 0/4] Update for Git's Message-Id to Message-ID switch Kyle Meyer
2023-04-30 22:15 ` [PATCH 1/4] piem-b4-am-from-mid: Tweak docstring for consistency Kyle Meyer
@ 2023-04-30 22:15 ` Kyle Meyer
2023-05-01 0:22 ` Kyle Meyer
2023-04-30 22:15 ` [PATCH 3/4] piem-am-ready-mbox: Change spelling of inserted message ID header Kyle Meyer
2023-04-30 22:15 ` [PATCH 4/4] Switch remaining Message-Id headers to Message-ID Kyle Meyer
3 siblings, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2023-04-30 22:15 UTC (permalink / raw)
To: piem
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 variants 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.
---
piem.el | 5 ++++-
tests/piem-tests.el | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/piem.el b/piem.el
index 63c358a2..9dc7f3e3 100644
--- a/piem.el
+++ b/piem.el
@@ -601,8 +601,11 @@ (defun piem--insert-message-id-header (mid)
(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 79d8591e..6f39a53e 100644
--- a/tests/piem-tests.el
+++ b/tests/piem-tests.el
@@ -179,6 +179,24 @@ (ert-deftest piem--insert-message-id-header ()
(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
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] piem-am-ready-mbox: Change spelling of inserted message ID header
2023-04-30 22:15 [PATCH 0/4] Update for Git's Message-Id to Message-ID switch Kyle Meyer
2023-04-30 22:15 ` [PATCH 1/4] piem-b4-am-from-mid: Tweak docstring for consistency Kyle Meyer
2023-04-30 22:15 ` [PATCH 2/4] piem-am-ready-mbox: Adjust header regex for format-patch change Kyle Meyer
@ 2023-04-30 22:15 ` Kyle Meyer
2023-05-01 0:34 ` Kyle Meyer
2023-04-30 22:15 ` [PATCH 4/4] Switch remaining Message-Id headers to Message-ID Kyle Meyer
3 siblings, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2023-04-30 22:15 UTC (permalink / raw)
To: piem
format-patch changed from Message-Id to Message-ID in git.git's
ba4324c4e1 (e-mail workflow: Message-ID is spelled with ID in both
capital letters, 2023-04-03). Update piem--insert-message-id-header
to follow Git's change.
---
piem.el | 6 +++---
tests/piem-tests.el | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/piem.el b/piem.el
index 9dc7f3e3..01985f0e 100644
--- a/piem.el
+++ b/piem.el
@@ -156,10 +156,10 @@ (defcustom piem-am-ready-mbox-functions nil
:type 'hook)
(defcustom piem-add-message-id-header nil
- "Whether to add Message-Id header to non-mail patches.
+ "Whether to add Message-ID header to non-mail patches.
If this value is non-nil and a patch returned by a function in
`piem-am-ready-mbox-functions' looks like a patch that was
-attached rather than sent inline, add a Message-Id header with
+attached rather than sent inline, add a Message-ID header with
the return value of `piem-mid'."
:type 'boolean)
@@ -615,7 +615,7 @@ (defun piem--insert-message-id-header (mid)
(when (= header-count 3)
;; Found all the expected headers before hitting a
;; blank line. Assume we're in a header.
- (insert (format "Message-Id: <%s>\n" mid))))))))
+ (insert (format "Message-ID: <%s>\n" mid))))))))
(defun piem-am-ready-mbox (&optional buffer-name)
"Generate a buffer containing an am-ready mbox.
diff --git a/tests/piem-tests.el b/tests/piem-tests.el
index 6f39a53e..7f9f30f3 100644
--- a/tests/piem-tests.el
+++ b/tests/piem-tests.el
@@ -181,7 +181,7 @@ (ert-deftest piem--insert-message-id-header ()
(piem--insert-message-id-header "msg@id")))
(should-not
(string-match-p
- "Message-Id: <msg@id>"
+ "Message-ID: <msg@id>"
(with-temp-buffer
(insert "\
From 0d732713af1f3fb48b37430e2cd0a3033cea14f3 Mon Sep 17 00:00:00 2001
@@ -200,9 +200,9 @@ (ert-deftest piem--insert-message-id-header ()
(should
(string-match-p
(concat
- (rx "Subject: [PATCH 1/2] a\nMessage-Id: <msg@id>\n"
+ (rx "Subject: [PATCH 1/2] a\nMessage-ID: <msg@id>\n"
(one-or-more anychar)
- "Subject: [PATCH 2/2] b\nMessage-Id: <msg@id>\n"))
+ "Subject: [PATCH 2/2] b\nMessage-ID: <msg@id>\n"))
(with-temp-buffer
(insert "\
From 0d732713af1f3fb48b37430e2cd0a3033cea14f3 Mon Sep 17 00:00:00 2001
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] Switch remaining Message-Id headers to Message-ID
2023-04-30 22:15 [PATCH 0/4] Update for Git's Message-Id to Message-ID switch Kyle Meyer
` (2 preceding siblings ...)
2023-04-30 22:15 ` [PATCH 3/4] piem-am-ready-mbox: Change spelling of inserted message ID header Kyle Meyer
@ 2023-04-30 22:15 ` Kyle Meyer
3 siblings, 0 replies; 7+ messages in thread
From: Kyle Meyer @ 2023-04-30 22:15 UTC (permalink / raw)
To: piem
The two previous commits updated the piem-add-message-id-header
functionality for git.git's change from Message-Id to Message-ID.
Updates a couple of remaining spots to use Message-ID for consistency.
---
piem.el | 2 +-
tests/piem-rmail-tests.el | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/piem.el b/piem.el
index 01985f0e..abc87b10 100644
--- a/piem.el
+++ b/piem.el
@@ -759,7 +759,7 @@ (defun piem--write-mbox-to-maildir (maildir-directory)
(save-excursion
(message-narrow-to-head-1)
(message-fetch-field "message-id" t)))
- (error "Message lacks Message-Id header")))))))
+ (error "Message lacks Message-ID header")))))))
(cl-incf n-skipped)
(let ((case-fold-search nil))
(while (re-search-forward
diff --git a/tests/piem-rmail-tests.el b/tests/piem-rmail-tests.el
index f56e2f26..7ee0a553 100644
--- a/tests/piem-rmail-tests.el
+++ b/tests/piem-rmail-tests.el
@@ -38,7 +38,7 @@ (defvar piem-rmail-tests-mbox-text "\
Cc: i@inbox.example.com
Subject: Re: test
Date: Sun, 23 May 2021 02:26:51 -0400
-Message-Id: <456@example.com>
+Message-ID: <456@example.com>
In-Reply-To: <123@example.com>
References: <123@example.com>
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] piem-am-ready-mbox: Adjust header regex for format-patch change
2023-04-30 22:15 ` [PATCH 2/4] piem-am-ready-mbox: Adjust header regex for format-patch change Kyle Meyer
@ 2023-05-01 0:22 ` Kyle Meyer
0 siblings, 0 replies; 7+ messages in thread
From: Kyle Meyer @ 2023-05-01 0:22 UTC (permalink / raw)
To: piem
Kyle Meyer writes:
> a Message-ID header instead of Message-Id. Teach
> piem--insert-message-id-header to look for either variants when it
s/variants/variant/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] piem-am-ready-mbox: Change spelling of inserted message ID header
2023-04-30 22:15 ` [PATCH 3/4] piem-am-ready-mbox: Change spelling of inserted message ID header Kyle Meyer
@ 2023-05-01 0:34 ` Kyle Meyer
0 siblings, 0 replies; 7+ messages in thread
From: Kyle Meyer @ 2023-05-01 0:34 UTC (permalink / raw)
To: piem
Kyle Meyer writes:
> format-patch changed from Message-Id to Message-ID in git.git's
> ba4324c4e1 [...]
When applying, I'll rephrase this a bit for clarity.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-05-01 0:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-30 22:15 [PATCH 0/4] Update for Git's Message-Id to Message-ID switch Kyle Meyer
2023-04-30 22:15 ` [PATCH 1/4] piem-b4-am-from-mid: Tweak docstring for consistency Kyle Meyer
2023-04-30 22:15 ` [PATCH 2/4] piem-am-ready-mbox: Adjust header regex for format-patch change Kyle Meyer
2023-05-01 0:22 ` Kyle Meyer
2023-04-30 22:15 ` [PATCH 3/4] piem-am-ready-mbox: Change spelling of inserted message ID header Kyle Meyer
2023-05-01 0:34 ` Kyle Meyer
2023-04-30 22:15 ` [PATCH 4/4] Switch remaining Message-Id headers to Message-ID Kyle Meyer
Code repositories for project(s) associated with this public inbox
https://git.kyleam.com/piem/
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).