From abd976b2f99bf7b5201b246f86ce7b8777b6fb15 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Wed, 19 Mar 2025 19:20:13 -0700 Subject: [PATCH] Support wonky names and missing names in commit Commit names can have some pretty weird stuff! Here is a real commit from the LLVM repo ``` commit a062856bcf4fca26dab06afdf14bf1c815831f9c Author: --global Date: Mon Oct 28 08:53:44 2019 -0700 [NFC] Comment endif to test commit access ``` Turns out that passing this to the mail client would fail since the `--` turns it to become an option. Also fixed the case where author names are missing. fixes #90 --- git_of_theseus/analyze.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_of_theseus/analyze.py b/git_of_theseus/analyze.py index 303cbb0..8492070 100644 --- a/git_of_theseus/analyze.py +++ b/git_of_theseus/analyze.py @@ -546,7 +546,7 @@ def dump_json(output_fn, key_type, label_fmt=lambda x: x): @functools.lru_cache(maxsize=None) def get_mailmap_author_name_email(repo, author_name, author_email): - pre_mailmap_author_email = f"{author_name} <{author_email}>" + pre_mailmap_author_email = f"{author_name.lstrip('-') if author_name else author_email} <{author_email}>" mail_mapped_author_email: str = repo.git.check_mailmap(pre_mailmap_author_email) mailmap_name, mailmap_email = mail_mapped_author_email[:-1].split(" <", maxsplit=1) return mailmap_name, mailmap_email