9 my $order_by = 'count';
 
  10 Getopt::Long::Configure(qw(bundling));
 
  12         'emails|e!' => \$match_emails,
 
  13         'names|n!'  => \$match_names,
 
  14         'count|c'   => sub { $order_by = 'count' },
 
  15         'time|t'    => sub { $order_by = 'stamp' },
 
  17 $match_emails = 1 unless $match_names;
 
  22 open(my $fh, '-|', "git log --format='%at <%aE> %aN'");
 
  24         my ($t, $e, $n) = /(\S+) <(\S+)> (.*)/;
 
  25         mark($email, $e, $n, $t);
 
  26         mark($name, $n, $e, $t);
 
  31         foreach my $e (dups($email)) {
 
  32                 foreach my $n (vals($email->{$e})) {
 
  33                         show($n, $e, $email->{$e}->{$n});
 
  39         foreach my $n (dups($name)) {
 
  40                 foreach my $e (vals($name->{$n})) {
 
  41                         show($n, $e, $name->{$n}->{$e});
 
  49         my ($h, $k, $v, $t) = @_;
 
  50         my $e = $h->{$k}->{$v} ||= { count => 0, stamp => 0 };
 
  52         $e->{stamp} = $t unless $t < $e->{stamp};
 
  57         return grep { keys($h->{$_}) > 1 } keys($h);
 
  63                 $h->{$b}->{$order_by} <=> $h->{$a}->{$order_by}
 
  69         print "$n <$e> ($h->{$order_by})\n";