Skip to content

Commit

Permalink
get_maintainers.pl: improve .mailmap parsing
Browse files Browse the repository at this point in the history
Entries that used formats other than "Proper Name <[email protected]>"
were not parsed properly.

Try to improve the parsing so that the entries in the forms of:
    Proper Name <[email protected]> <[email protected]>
and
    Proper Name <[email protected]> Commit Name <[email protected]>
are transformed correctly.

Signed-off-by: Joe Perches <[email protected]>
Reviewed-by: Florian Mickler <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Jul 26, 2011
1 parent 626a031 commit 0334b38
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/get_maintainer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -328,21 +328,22 @@ sub read_mailmap {
# name1 <mail1> <mail2>
# name1 <mail1> name2 <mail2>
# (see man git-shortlog)
if (/^(.+)<(.+)>$/) {

if (/^([^<]+)<([^>]+)>$/) {
my $real_name = $1;
my $address = $2;

$real_name =~ s/\s+$//;
($real_name, $address) = parse_email("$real_name <$address>");
$mailmap->{names}->{$address} = $real_name;

} elsif (/^<([^\s]+)>\s*<([^\s]+)>$/) {
} elsif (/^<([^>]+)>\s*<([^>]+)>$/) {
my $real_address = $1;
my $wrong_address = $2;

$mailmap->{addresses}->{$wrong_address} = $real_address;

} elsif (/^(.+)<([^\s]+)>\s*<([^\s]+)>$/) {
} elsif (/^(.+)<([^>]+)>\s*<([^>]+)>$/) {
my $real_name = $1;
my $real_address = $2;
my $wrong_address = $3;
Expand All @@ -353,7 +354,7 @@ sub read_mailmap {
$mailmap->{names}->{$wrong_address} = $real_name;
$mailmap->{addresses}->{$wrong_address} = $real_address;

} elsif (/^(.+)<([^\s]+)>\s*([^\s].*)<([^\s]+)>$/) {
} elsif (/^(.+)<([^>]+)>\s*(.+)\s*<([^>]+)>$/) {
my $real_name = $1;
my $real_address = $2;
my $wrong_name = $3;
Expand Down

0 comments on commit 0334b38

Please sign in to comment.