From f75224f1ce5ce7ff60d2f8fdee818cc7b17b95d7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 18 Jul 2021 16:20:23 -0700 Subject: [PATCH] tools: email matchin is case insensitive for .mailmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/39430 Reviewed-By: Tobias Nießen Reviewed-By: Michaël Zasso Reviewed-By: James M Snell --- tools/update-authors.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/update-authors.js b/tools/update-authors.js index 312f253c4854e5..f9797b1998c3d9 100755 --- a/tools/update-authors.js +++ b/tools/update-authors.js @@ -41,19 +41,21 @@ const mailmap = new CaseIndifferentMap(); let match; // Replaced Name if (match = line.match(/^([^<]+)\s+(<[^>]+>)$/)) { - mailmap.set(match[2], { author: match[1] }); + mailmap.set(match[2].toLowerCase(), { + author: match[1], email: match[2] + }); // } else if (match = line.match(/^<([^>]+)>\s+(<[^>]+>)$/)) { - mailmap.set(match[2], { email: match[1] }); + mailmap.set(match[2].toLowerCase(), { email: match[1] }); // Replaced Name } else if (match = line.match(/^([^<]+)\s+(<[^>]+>)\s+(<[^>]+>)$/)) { - mailmap.set(match[3], { + mailmap.set(match[3].toLowerCase(), { author: match[1], email: match[2] }); // Replaced Name Original Name } 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 }); }