cat-file: mailmap is not applied for committer email
Repository with reproduction steps: https://gitlab.com/vyaklushin/git-mailmap-bug
Context
git cat-file HEAD --mailmap
command should return modified author and committer emails based on the configuration from .mailmap
file.
It works as expected when both author and committer are identical.
- Original author and committer email: viakliushin@gitlab.com
- Mailmapped email: mailmapped-user@gitlab.com
Without mailmap:
git cat-file -p e3fb1d356a3f490908b5002574aefaca576e0837
tree 058a289a44e8be3f6f6b3e03f0ab5aaadd78fd93
parent 6b351adcd6c867b69e90de9203a9a5ecfe469b43
author Vasilii Iakliushin <viakliushin@gitlab.com> 1747238536 +0200
committer Vasilii Iakliushin <viakliushin@gitlab.com> 1747238536 +0200
With mailmap:
git cat-file -p e3fb1d356a3f490908b5002574aefaca576e0837 --mailmap
tree 058a289a44e8be3f6f6b3e03f0ab5aaadd78fd93
parent 6b351adcd6c867b69e90de9203a9a5ecfe469b43
author Mailmapped User <mailmapped-user@gitlab.com> 1747238536 +0200
committer Mailmapped User <mailmapped-user@gitlab.com> 1747238536 +0200
Problem
When author email is different from the committer email and committer email is mailmapped, then git cat-file
ignores --mailmap
flag.
Without mailmap:
git cat-file -p 318f7c6ec59858cd51f63c6713643c809130b005
tree aec29cd51601fc73ce9ff2c889c3a15a4be45602
parent e3fb1d356a3f490908b5002574aefaca576e0837
author Test <user@example.com> 1747238582 +0200
committer Vasilii Iakliushin <viakliushin@gitlab.com> 1747238582 +0200
With mailmap:
git cat-file -p 318f7c6ec59858cd51f63c6713643c809130b005 --mailmap
tree aec29cd51601fc73ce9ff2c889c3a15a4be45602
parent e3fb1d356a3f490908b5002574aefaca576e0837
author Test <user@example.com> 1747238582 +0200
committer Vasilii Iakliushin <viakliushin@gitlab.com> 1747238582 +0200 # <-- wrong! Should be mailmapped-user@gitlab.com as defined in `.mailmap` file