Skip to content
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

Follow git logic when parsing patch identities #44

Merged
merged 2 commits into from
May 6, 2024
Merged

Commits on May 6, 2024

  1. Follow git logic when parsing patch identities

    When GitHub creates patches for Dependabot PRs, it generates a "From:"
    line that is not valid according to RFC 5322: the address spec contains
    unquoted special characters (the "[bot]" in "dependabot[bot]"). While
    the 'net/mail' parser makes some exceptions to the spec, this is not one
    of them, so parsing these patch headers fails.
    
    Git's 'mailinfo' command avoids this by only implementing the unquoting
    part of RFC 5322 and then applying a heuristic to separate the string in
    to name and email values that seem reasonable.
    
    This commit does two things:
    
    1. Reimplements ParsePatchIdentity to follow Git's logic, so that it can
       accept a wider range of inputs, including quoted strings.  Strings
       accepted by the previous implementation parse in the same way with
       one exception: inputs that contain whitespace inside the angle
       brackets for an email address now use the email address as the name
       and drop any separate name component.
    
    2. When parsing mail-formatted patches, use ParsePatchIdentity to parse
       the "From:" line instead of the 'net/mail' function.
    bluekeyes committed May 6, 2024
    Configuration menu
    Copy the full SHA
    8a7b2f6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    885b73f View commit details
    Browse the repository at this point in the history