# [BUG] git format-patch incorrectly follows the mailmap when used with --cover-letter

4 messages from 2022-11-02 to 2022-11-03. Participants: L. E. Segovia, Taylor Blau.
Thread: https://gitlist.dev/t/58738

## L. E. Segovia, 2022-11-02 23:54

Subject: [BUG] git format-patch incorrectly follows the mailmap when used with --cover-letter
Message-ID: <cb90779b-edb0-1911-c8bd-a6c56203a201@amyspark.me>
URL: https://gitlist.dev/e/cb90779b-edb0-1911-c8bd-a6c56203a201%40amyspark.me

```
Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

Issued git format-patch -M master -o patches/ --cover-letter inside a
given repository (hereafter "current repository").

What did you expect to happen? (Expected behavior)

The cover letter should have tallied my commits and associate them with
the current repository's user.name value.

What happened instead? (Actual behavior)

The cover letter follows my active mailmap and applies it when tallying
the commits. There is no way to tell it not to.

What's different between what you expected and what actually happened?

git format-patch is not consistent in applying authorship values. The
cover letter uses user.* to construct the From: line, which is correct;
but the authorship stats instead follow the mailmap.

Anything else you want to add:

To reproduce, set in your global .mailmap an entry remapping the
current repository's user.email value to a different author name than what is
stored in the repository's user.name. Then issue the git format-patch
line as described above.

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.38.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Darwin 20.6.0 Darwin Kernel Version 20.6.0: Thu Sep 29 20:15:11 PDT 2022; root:xnu-7195.141.42~1/RELEASE_X86_64 x86_64
compiler info: clang: 13.0.0 (clang-1300.0.29.30)
libc info: no libc information available
$SHELL (typically, interactive shell): /usr/local/bin/fish


[Enabled Hooks]

-- 
amyspark 🌸 https://www.amyspark.me

```

## Taylor Blau, 2022-11-03 00:09

Subject: Re: [BUG] git format-patch incorrectly follows the mailmap when used with --cover-letter
Message-ID: <Y2MGyM3O7ljEZ4Hm@nand.local>
URL: https://gitlist.dev/e/Y2MGyM3O7ljEZ4Hm%40nand.local
In-Reply-To: <cb90779b-edb0-1911-c8bd-a6c56203a201@amyspark.me>

```
On Wed, Nov 02, 2022 at 08:54:32PM -0300, L. E. Segovia wrote:
> What did you expect to happen? (Expected behavior)
>
> The cover letter should have tallied my commits and associate them with
> the current repository's user.name value.
>
> What happened instead? (Actual behavior)
>
> The cover letter follows my active mailmap and applies it when tallying
> the commits. There is no way to tell it not to.

Are you referring to the shortlog in the cover letter, the patches
themselves, or both?

As you note, there is no '--[no-]mailmap' option in format-patch, though
implementing one should be relatively straightforward.

Thanks,
Taylor

```

## L. E. Segovia, 2022-11-03 00:21

Subject: Re: [BUG] git format-patch incorrectly follows the mailmap when used with --cover-letter
Message-ID: <527f8050-7955-50b1-304c-617703cf99e6@amyspark.me>
URL: https://gitlist.dev/e/527f8050-7955-50b1-304c-617703cf99e6%40amyspark.me
In-Reply-To: <Y2MGyM3O7ljEZ4Hm@nand.local>

```
Hey,

The shortlog in the cover letter follows the active mailmap (incorrectly).
The letter itself (From: header), as well as the patches, are attributed
correctly.

Best,

amyspark

On 02/11/2022 21:09, Taylor Blau wrote:
> On Wed, Nov 02, 2022 at 08:54:32PM -0300, L. E. Segovia wrote:
>> What did you expect to happen? (Expected behavior)
>>
>> The cover letter should have tallied my commits and associate them with
>> the current repository's user.name value.
>>
>> What happened instead? (Actual behavior)
>>
>> The cover letter follows my active mailmap and applies it when tallying
>> the commits. There is no way to tell it not to.
> 
> Are you referring to the shortlog in the cover letter, the patches
> themselves, or both?
> 
> As you note, there is no '--[no-]mailmap' option in format-patch, though
> implementing one should be relatively straightforward.
> 
> Thanks,
> Taylor

-- 
amyspark 🌸 https://www.amyspark.me

```

## Taylor Blau, 2022-11-03 00:26

Subject: Re: [BUG] git format-patch incorrectly follows the mailmap when used with --cover-letter
Message-ID: <Y2MKr2Yga/o1sjun@nand.local>
URL: https://gitlist.dev/e/Y2MKr2Yga%2Fo1sjun%40nand.local
In-Reply-To: <527f8050-7955-50b1-304c-617703cf99e6@amyspark.me>

```
On Wed, Nov 02, 2022 at 09:21:12PM -0300, L. E. Segovia wrote:
> Hey,
>
> The shortlog in the cover letter follows the active mailmap (incorrectly).

You say "incorrectly", but this is subjective, no?

I imagine that most (?) users of format-patch do want to respect the
mailmap when generating a shortlog. In fact, the 'git shortlog' builtin
doesn't even have a `--[no-]mailmap` option, either.

> The letter itself (From: header), as well as the patches, are attributed
> correctly.

OK.

Thanks,
Taylor

```
