Skip to content

RFE: Message-ID support #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
awilliam opened this issue Sep 24, 2019 · 7 comments
Open

RFE: Message-ID support #42

awilliam opened this issue Sep 24, 2019 · 7 comments

Comments

@awilliam
Copy link

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!

@awilliam
Copy link
Author

awilliam commented Mar 30, 2021

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)

@chucklever
Copy link
Contributor

Is there a config or cmdline option to disable this behavior?

@jpgrayson
Copy link
Collaborator

No, should there be?

@chucklever
Copy link
Contributor

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.

@chucklever
Copy link
Contributor

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.

@jpgrayson
Copy link
Collaborator

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:

  1. Add a command line option to enable this behavior, e.g. --message-id to mirror the git-mailinfo option name.
  2. Add a configuration option, e.g. stgit.import.messageid to enable this behavior. Default to disabled.
  3. 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.

@jpgrayson jpgrayson reopened this Oct 8, 2021
@chucklever
Copy link
Contributor

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:

[email protected]

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.

jpgrayson added a commit that referenced this issue Oct 9, 2021
The new --message-id option enables capturing the Message-ID header as
the Message-Id trailer when importing patches from emails. The
Message-ID is no longer captured by default. I.e. StGit's default
behavior reverts to as it was before v1.2.

The new stgit.import.messageid config option may be set to enable this
behavior by default.

Partially addresses #42.

Signed-off-by: Peter Grayson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants