git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] check-mailmap: add --no-brackets mode

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Aug 16, 2024, 23:22 UTC
Message-ID
<CAPig+cSN-KU-TQ5UBR9KfxjmQ4zzjL-Y-anxDe9FaeqsV=1Xww@mail.gmail.com>
In-Reply-To
<20240816-jk-send-email-mailmap-support-v1-1-68ca5b4a6078@gmail.com>
On Fri, Aug 16, 2024 at 7:06 PM Jacob Keller <jacob.e.keller@intel.com> wrote:
Show 9 quoted lines
> The git check-mailmap command can be used to convert identities to their
> canonical real name and email address. Currently, if a simple email
> address is provided without surrounding angle brackets, git
> check-mailmap will fail:
>
>   $ git check-mailmap test@example.com
>   fatal: unable to parse contact: test@example.com
>
> This is generally fine since identifies are expected to be of the form
s/identifies/identities/
Show 13 quoted lines
> "name <email@domain>". However, requiring brackets around simple email
> addresses can make it difficult to support mailmap operation in other
> environments where angle brackets may be missing.
>
> Specifically, attempting to support the mailmap within git send-email is
> tricky, since angle brackets are not always provided for addresses.
>
> Teach check-mailmap a new '--no-brackets' mode. In this mode, any
> contact line which cannot be interpreted by split_ident_line is treated
> as a simple address without a name. In addition, when any contact does
> not have a name, output the mail address without the angle brackets.
> Note that angle brackets are accepted if they are present, however the
> output will strip them.

What is not explained by the commit message is why we need this new option as opposed to merely making git-check-mailmap accept such addresses by default. Are there difficulties or downsides to making this the default behavior? Do other things break if this new behavior becomes the default as opposed to being an explicit opt-in?

> This mode will be useful for git send-email in a following feature
> implementation to enable mapping any email addresses to their canonical
> value.

I'm a bit skeptical about how this new flag also changes the output format to suppress the angle brackets. It seems like that's something the caller could do easily enough if desired. For instance:

    $addr =~ s/^<(.*)>$/\1/;
Or, is there some deeper reason for doing this?
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Previous: Jacob KellerNext: Jacob Keller
Message 3 of 8 in “send-email: add --mailmap support”
  1. 0/2 send-email: add --mailmap supportJacob Keller, Aug 16, 2024
  2. 1/2 check-mailmap: add --no-brackets modeJacob Keller, Aug 16, 2024
  3. Eric SunshineAug 16, 2024
  4. Jacob KellerAug 16, 2024
  5. Eric SunshineAug 16, 2024
  6. 2/2 send-email: add support for --mailmapJacob Keller, Aug 16, 2024
  7. Eric SunshineAug 16, 2024
  8. Jacob KellerAug 16, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.