8000 Validate `Cc:` lines before using them · Issue #1645 · gitgitgadget/gitgitgadget · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Validate Cc: lines before using them #1645

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
dscho opened this issue Jul 1, 2024 · 1 comment
Open

Validate Cc: lines before using them #1645

dscho opened this issue Jul 1, 2024 · 1 comment

Comments

@dscho
Copy link
Member
dscho commented Jul 1, 2024

In #1644 documentation was added to warn users against copy/pasting Cc: lines from previous GitGitGadget PRs. The reason for this is that they are "rendered as Markdown", but the rendered versions are not valid.

Instead of just warning users against this, let's help even more by refusing to send such mails and offer guidance how to get out of this situation.

@dscho
Copy link
Member Author
dscho commented Jul 2, 2024

Let me add a bit of information that should help any volunteer to get started:

  • This is the mail containing the complaint about the issue, but this is probably a more informative link, as it describes the problem: When copy/pasting Cc: lists from an existing GitGitGadget PR, they are no longer in the correct format; Instead of something like "Cc: Junio C Hamano mailto:gitster@pobox.com" the lines read like "Cc: Junio C Hamano gitster@pobox.com".
  • Here is where the Cc: footers are parsed.
  • Here is the part of the test suite that will need to be imitated to verify that this ticket is addressed properly.
  • Here is an example how to verify that a specific exception is thrown (which allows us to verify the error message, too).
  • The error message could be something helpful along the lines of "The line '...' was probably copy/pasted from another PR but is in an incorrect format; It needs to be in the format '...' instead".
  • An even much, much better idea might be to handle the Markdown-formatted lines gracefully, heeding Postel's law. That is, before even letting the addressparser try to parse the line, try to match the regular expression /^[A-Za-z ]+\s+\[([^ @]+@[^@]+)\]\(mailto:\1\)/. If it matches, use the captured groups, otherwise let addressparser have a crack at it.

We may still want to validate the email addresses in addition to that.

While at it, we could add a doozie on top and run the addresses through git check-mailmap --stdin so that e.g. email addresses copied from old commits are automagically converted to the superseding addresses recorded in Git's own .mailmap.

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

1 participant
0