Commit 0334b382 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

get_maintainers.pl: improve .mailmap parsing

Entries that used formats other than "Proper Name <commit@email.xx>"
were not parsed properly.

Try to improve the parsing so that the entries in the forms of:
    Proper Name <proper@email.xx> <commit@email.xx>
and
    Proper Name <proper@email.xx> Commit Name <commit@email.xx>
are transformed correctly.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Reviewed-by: default avatarFlorian Mickler <florian@mickler.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 626a0312
...@@ -328,7 +328,8 @@ sub read_mailmap { ...@@ -328,7 +328,8 @@ sub read_mailmap {
# name1 <mail1> <mail2> # name1 <mail1> <mail2>
# name1 <mail1> name2 <mail2> # name1 <mail1> name2 <mail2>
# (see man git-shortlog) # (see man git-shortlog)
if (/^(.+)<(.+)>$/) {
if (/^([^<]+)<([^>]+)>$/) {
my $real_name = $1; my $real_name = $1;
my $address = $2; my $address = $2;
...@@ -336,13 +337,13 @@ sub read_mailmap { ...@@ -336,13 +337,13 @@ sub read_mailmap {
($real_name, $address) = parse_email("$real_name <$address>"); ($real_name, $address) = parse_email("$real_name <$address>");
$mailmap->{names}->{$address} = $real_name; $mailmap->{names}->{$address} = $real_name;
} elsif (/^<([^\s]+)>\s*<([^\s]+)>$/) { } elsif (/^<([^>]+)>\s*<([^>]+)>$/) {
my $real_address = $1; my $real_address = $1;
my $wrong_address = $2; my $wrong_address = $2;
$mailmap->{addresses}->{$wrong_address} = $real_address; $mailmap->{addresses}->{$wrong_address} = $real_address;
} elsif (/^(.+)<([^\s]+)>\s*<([^\s]+)>$/) { } elsif (/^(.+)<([^>]+)>\s*<([^>]+)>$/) {
my $real_name = $1; my $real_name = $1;
my $real_address = $2; my $real_address = $2;
my $wrong_address = $3; my $wrong_address = $3;
...@@ -353,7 +354,7 @@ sub read_mailmap { ...@@ -353,7 +354,7 @@ sub read_mailmap {
$mailmap->{names}->{$wrong_address} = $real_name; $mailmap->{names}->{$wrong_address} = $real_name;
$mailmap->{addresses}->{$wrong_address} = $real_address; $mailmap->{addresses}->{$wrong_address} = $real_address;
} elsif (/^(.+)<([^\s]+)>\s*([^\s].*)<([^\s]+)>$/) { } elsif (/^(.+)<([^>]+)>\s*(.+)\s*<([^>]+)>$/) {
my $real_name = $1; my $real_name = $1;
my $real_address = $2; my $real_address = $2;
my $wrong_name = $3; my $wrong_name = $3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment