stgit
stgit copied to clipboard
RFE: Message-ID support
It would be useful if the Message-ID header could be extracted from email imports and optionally included in the commit log. For example, a new --msgid option to the import command would result in the following being appended to the commit log before any new sign-offs/acks/reviews: Message-Id: [email protected]
Ideally configuration options might allow the Message-Id string to be changed and the reference to be manipulated (via regex?), such that this same support could generate: Link: https://lore.kernel.org/r/[email protected]
This support would align well with better patch tracking that many maintainers are adopting. Thanks!
Now that stgit uses mailinfo, this is just creating an option to use the -m flag. A hard coded variant is simply:
diff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py
index 92c7d59e44fe..0ccd39752473 100644
--- a/stgit/commands/imprt.py
+++ b/stgit/commands/imprt.py
@@ -364,7 +364,7 @@ def __import_mail_path(mail_path, filename, options):
patch_path = mail_path + '-patch'
mailinfo_lines = (
- Run('git', 'mailinfo', msg_path, patch_path)
+ Run('git', 'mailinfo', '-m', msg_path, patch_path)
.encoding(None)
.decoding(None)
.raw_input(mail)
Is there a config or cmdline option to disable this behavior?
No, should there be?
The Linux kernel subsystem maintainer workflow uses lore, b4, and DKIM attestation, so generally a Message-ID: tag is not required or used. I plan to delete Message-ID: tags after importing patches from mailing lists, at least until such time as Message-ID: becomes a requirement for submitting patches to the Linux kernel. It would save me a step if stg import simply skipped adding them.
Well, let me put this a better way. My impression is that when a reference to an e-mail is needed, a kernel commit requires a link to a permanent e-mail archive. Something like:
Link: https://lore.kernel.org/linux-nfs/163303597560.5125.8905823373792865984.stgit@klimt.1015granger.net/T/#u
Ah, now that I read the RFE text more closely, I see awilliam was asking for just such a thing.
Anyway, I will have to convert or delete each Message-Id: tag, which takes away some convenience.
This is great context @chucklever, thank you. I think I was a bit too cavalier in turning-on this message-id copying behavior by default, sorry about that. I'm also guilty of overlooking key details in @awilliam's original request--sorry about that too.
Some options for the path forward:
- Add a command line option to enable this behavior, e.g.
--message-idto mirror thegit-mailinfooption name. - Add a configuration option, e.g.
stgit.import.messageidto enable this behavior. Default to disabled. - Add a configuration option(s) to specify how to transform the message-id reference as @awilliam originally indicated (and that I overlooked).
Adding basic configurability (1 and 2) seems like a no-brainer. I'll take care of those.
But I'm not feeling super confident about designing 3. Seems like we'd need configuration options covering:
- Regex to transform the message-id reference (
stgit.import.msgidXlateRegex?). What form would we want this regex to take? Examples would be helpful. - Trailer name to go with the transformed reference (E.g. "Link") (
stgit.import.msgidXlateTrailer) - An option to disable this behavior (
stgit.import.msgidXlate)? Or is the absence of a regex sufficient? - Command line option variants of the above (to supplement the config options)?
- Capability to do multiple transformations?
I'm looking for help specifying the desired behaviors as well as suggestions for naming of the config options.
Thank you for reconsidering.
You probably want a hook for translating a message-id into a URL. The b4 tool appears to have a simple translation scheme. For example:
is converted into
https://lore.kernel.org/r/1633645823-31235-1-git-send-email-dwysocha%40redhat.com
Maybe a subcommand could be added to b4 to do only this translation, then stg mail could run that when needed? Other projects might provide a hook script to do this the way they like.