diff options
author | Rich Trott <rtrott@gmail.com> | 2021-07-19 02:20:23 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-09-04 16:14:32 +0300 |
commit | f75224f1ce5ce7ff60d2f8fdee818cc7b17b95d7 (patch) | |
tree | b4a3ca0a38c26e314cf7284a42c1eacaf9e99d9e /tools | |
parent | dfb77a581fbc41acfaa49b8baaf0bc0cde03c1af (diff) |
tools: email matchin is case insensitive for .mailmap
PR-URL: https://github.com/nodejs/node/pull/39430
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/update-authors.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/update-authors.js b/tools/update-authors.js index 312f253c485..f9797b1998c 100755 --- a/tools/update-authors.js +++ b/tools/update-authors.js @@ -41,19 +41,21 @@ const mailmap = new CaseIndifferentMap(); let match; // Replaced Name <original@example.com> if (match = line.match(/^([^<]+)\s+(<[^>]+>)$/)) { - mailmap.set(match[2], { author: match[1] }); + mailmap.set(match[2].toLowerCase(), { + author: match[1], email: match[2] + }); // <replaced@example.com> <original@example.com> } else if (match = line.match(/^<([^>]+)>\s+(<[^>]+>)$/)) { - mailmap.set(match[2], { email: match[1] }); + mailmap.set(match[2].toLowerCase(), { email: match[1] }); // Replaced Name <replaced@example.com> <original@example.com> } else if (match = line.match(/^([^<]+)\s+(<[^>]+>)\s+(<[^>]+>)$/)) { - mailmap.set(match[3], { + mailmap.set(match[3].toLowerCase(), { author: match[1], email: match[2] }); // Replaced Name <replaced@example.com> Original Name <original@example.com> } else if (match = line.match(/^([^<]+)\s+(<[^>]+>)\s+([^<]+)\s+(<[^>]+>)$/)) { - mailmap.set(match[3] + '\0' + match[4], { + mailmap.set(match[3] + '\0' + match[4].toLowerCase(), { author: match[1], email: match[2] }); } else { @@ -75,8 +77,10 @@ rl.on('line', (line) => { if (!match) return; let { author, email } = match.groups; + const emailLower = email.toLowerCase(); - const replacement = mailmap.get(author + '\0' + email) || mailmap.get(email); + const replacement = + mailmap.get(author + '\0' + emailLower) || mailmap.get(emailLower); if (replacement) { ({ author, email } = { author, email, ...replacement }); } |