diff mbox series

[b4] send: generate patches with --no-mailmap

Message ID 20240820-send-mailmap-v1-1-7f35789be4b1@kernel.org (mailing list archive)
State New
Headers show
Series [b4] send: generate patches with --no-mailmap | expand

Commit Message

Matthieu Baerts (NGI0) Aug. 20, 2024, 11:10 a.m. UTC
b4 uses 'git show' to generate patches. By default, this command will
use the mailmap file to convert author and committer names and email
addresses if there is a match.

That's good to display the last identity when looking at old commits in
the history, but it doesn't sound like a good idea when sending patches.
'git format-patch' doesn't use the mailmap file, it currently doesn't
even support it, and it is not planned to support it apparently [1].
Note that 'git send-email' might support a new '--mailmap' option, but
it looks like this option will not be enabled by default [2].

In my case, I had to send some patches, including one from someone else
who has to use the email address from his company, but has an entry in
the mailmap file to his @kernel.org email address. When I sent his
patch, b4 seamlessly converted his email address, and caused checkpatch
to complain, because the From and the SoB entries were different.

Here, we ensure the conversion is not done, to avoid any surprise once
the emails are sent.

Link: https://lore.kernel.org/all/20240813-jk-support-mailmap-git-format-patch-v1-1-1aea690ea5dd@gmail.com/ [1]
Link: https://lore.kernel.org/all/20240819-jk-send-email-mailmap-support-v2-0-d212c3f9e505@gmail.com/ [2]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 src/b4/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 37811c93f50e70f325e45107a9a20ffc69f2f6dc
change-id: 20240820-send-mailmap-ef8ba398450f

Best regards,
diff mbox series

Patch

diff --git a/src/b4/__init__.py b/src/b4/__init__.py
index 2b1a058..283a5d5 100644
--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -3411,7 +3411,7 @@  def git_range_to_patches(gitdir: Optional[str], start: str, end: str,
             logger.debug('Ignoring commit %s', commit)
             continue
         ecode, out = git_run_command(gitdir, ['show', '--format=email', '--patch-with-stat', '--encoding=utf-8',
-                                              commit], decode=False)
+                                              '--no-mailmap', commit], decode=False)
         if ecode > 0:
             raise RuntimeError(f'Could not get a patch out of {commit}')
         msg = email.message_from_bytes(out, policy=emlpolicy)