Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164514
b: refs/heads/master
c: 8cbb3a7
h: refs/heads/master
v: v3
  • Loading branch information
Joe Perches authored and Linus Torvalds committed Sep 22, 2009
1 parent 123c59d commit 1d93fa6
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0e70e83dfd40cac47e1fc3e2f1c7b893ea0cd2f8
refs/heads/master: 8cbb3a77e1a91073fb279a495a11d5093461dfe5
72 changes: 65 additions & 7 deletions trunk/scripts/get_maintainer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,36 @@
}
close(MAINT);

my %mailmap;

open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n";
while (<MAILMAP>) {
my $line = $_;

next if ($line =~ m/^\s*#/);
next if ($line =~ m/^\s*$/);

my ($name, $address) = parse_email($line);
$line = format_email($name, $address);

next if ($line =~ m/^\s*$/);

if (exists($mailmap{$name})) {
my $obj = $mailmap{$name};
push(@$obj, $address);
} else {
my @arr = ($address);
$mailmap{$name} = \@arr;
}
}
close(MAILMAP);

foreach my $name (sort {$mailmap{$a} <=> $mailmap{$b}} keys %mailmap) {
my $obj = $mailmap{$name};
foreach my $address (@$obj) {
}
}

## use the filenames on the command line or find the filenames in the patchfiles

my @files = ();
Expand Down Expand Up @@ -403,12 +433,12 @@ sub parse_email {
my $name = "";
my $address = "";

if ($formatted_email =~ /^([^<]+)<(.*\@.*)>$/) {
if ($formatted_email =~ /^([^<]+)<(.*\@.*)>.*$/) {
$name = $1;
$address = $2;
} elsif ($formatted_email =~ /^<(.*\@.*)>$/) {
} elsif ($formatted_email =~ /^\s*<(.*\@.*)>.*$/) {
$address = $1;
} elsif ($formatted_email =~ /^(.*\@.*)$/) {
} elsif ($formatted_email =~ /^\s*(.*\@.*)$/) {
$address = $1;
}

Expand Down Expand Up @@ -557,6 +587,29 @@ sub which {
return "";
}

sub mailmap {
my @lines = @_;
my %hash;

foreach my $line (@lines) {
my ($name, $address) = parse_email($line);
if (!exists($hash{$name})) {
$hash{$name} = $address;
}
if (exists($mailmap{$name})) {
my $obj = $mailmap{$name};
foreach my $map_address (@$obj) {
if (($map_address eq $address) &&
($map_address ne $hash{$name})) {
$line = format_email($name, $hash{$name});
}
}
}
}

return @lines;
}

sub recent_git_signoffs {
my ($file) = @_;

Expand Down Expand Up @@ -592,9 +645,10 @@ sub recent_git_signoffs {
# cut -f2- -d":"
s/.*:\s*(.+)\s*/$1/ for (@lines);

$total_sign_offs = @lines;

@lines = mailmap(@lines);

$total_sign_offs = @lines;
@lines = sort(@lines);
# uniq -c
foreach my $line (@lines) {
Expand Down Expand Up @@ -655,12 +709,12 @@ sub git_assign_blame {
my $diff_start = $2;
my $diff_length = $3;
next if (!("$file" eq "$diff_file"));
$cmd = "git blame -l -L $diff_start,+$diff_length $file\n";
$cmd = "git blame -l -L $diff_start,+$diff_length $file";
@commits = save_commits($cmd, @commits);
}
} else {
if (-f $file) {
$cmd = "git blame -l $file\n";
$cmd = "git blame -l $file";
@commits = save_commits($cmd, @commits);
}
}
Expand All @@ -678,11 +732,15 @@ sub git_assign_blame {
if (!$email_git_penguin_chiefs) {
@lines = grep(!/${penguin_chiefs}/i, @lines);
}

# cut -f2- -d":"
s/.*:\s*(.+)\s*/$1/ for (@lines);

$hash{$_}++ for @lines;
$total_sign_offs += @lines;

@lines = mailmap(@lines);

$hash{$_}++ for @lines;
}

$count = 0;
Expand Down

0 comments on commit 1d93fa6

Please sign in to comment.