Skip to content

Commit 7570f99

Browse files
TrottBethGriggs
authored andcommitted
tools: email matchin is case insensitive for .mailmap
PR-URL: #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>
1 parent 5c11a02 commit 7570f99

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎tools/update-authors.js‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,21 @@ const mailmap = new CaseIndifferentMap();
4141
letmatch;
4242
// Replaced Name <original@example.com>
4343
if(match=line.match(/^([^<]+)\s+(<[^>]+>)$/)){
44-
mailmap.set(match[2],{author: match[1]});
44+
mailmap.set(match[2].toLowerCase(),{
45+
author: match[1],email: match[2]
46+
});
4547
// <replaced@example.com> <original@example.com>
4648
}elseif(match=line.match(/^<([^>]+)>\s+(<[^>]+>)$/)){
47-
mailmap.set(match[2],{email: match[1]});
49+
mailmap.set(match[2].toLowerCase(),{email: match[1]});
4850
// Replaced Name <replaced@example.com> <original@example.com>
4951
}elseif(match=line.match(/^([^<]+)\s+(<[^>]+>)\s+(<[^>]+>)$/)){
50-
mailmap.set(match[3],{
52+
mailmap.set(match[3].toLowerCase(),{
5153
author: match[1],email: match[2]
5254
});
5355
// Replaced Name <replaced@example.com> Original Name <original@example.com>
5456
}elseif(match=
5557
line.match(/^([^<]+)\s+(<[^>]+>)\s+([^<]+)\s+(<[^>]+>)$/)){
56-
mailmap.set(match[3]+'\0'+match[4],{
58+
mailmap.set(match[3]+'\0'+match[4].toLowerCase(),{
5759
author: match[1],email: match[2]
5860
});
5961
}else{
@@ -75,8 +77,10 @@ rl.on('line', (line) => {
7577
if(!match)return;
7678

7779
let{ author, email }=match.groups;
80+
constemailLower=email.toLowerCase();
7881

79-
constreplacement=mailmap.get(author+'\0'+email)||mailmap.get(email);
82+
constreplacement=
83+
mailmap.get(author+'\0'+emailLower)||mailmap.get(emailLower);
8084
if(replacement){
8185
({ author, email }={ author, email, ...replacement});
8286
}

0 commit comments

Comments
 (0)