Kaydet (Commit) 249b6a55 authored tarafından Christian Lohmaier's avatar Christian Lohmaier

lo-commit-stat: use matching group before destroying it with another match

it also doesn't make sense to numerically compare a %hash
enable warnings in the script and remove a duplicated variable (and
some unnecessary hash-declarations)

Change-Id: I0a84dc28f369931ee31a1cf12849fde2b63f1ca2
üst 0b8cccdc
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#!/usr/bin/perl #!/usr/bin/perl
use strict; use strict;
use warnings;
use LWP::UserAgent; use LWP::UserAgent;
use utf8; use utf8;
use File::Temp; use File::Temp;
...@@ -157,26 +158,24 @@ sub load_git_log($$$$$$$) ...@@ -157,26 +158,24 @@ sub load_git_log($$$$$$$)
# } # }
open (GIT, "$cmd 2>&1|") || die "Can't run $cmd: $!"; open (GIT, "$cmd 2>&1|") || die "Can't run $cmd: $!";
%{$pdata->{$module}} = ();
while (my $line = <GIT>) { while (my $line = <GIT>) {
chomp $line; chomp $line;
if ( $line =~ m/^commit ([0-9a-z]{20})/ ) { if ( $line =~ m/^commit ([0-9a-z]{20})/ ) {
$commit_id = "$1"; $commit_id = $1;
$summary=undef; $summary=undef;
%{$pdata->{$module}{"$commit_id"}} = ();
next; next;
} }
if ( $line =~ /^Author:\s*([^\<]*)\<([^\>]*)>/ ) { if ( $line =~ /^Author:\s*([^\<]*)\<([^\>]*)>/ ) {
# get rid of extra empty spaces; # get rid of extra empty spaces;
my $name = "$1"; my $name = $1;
my $email = $2;
$name =~ s/\s+$//; $name =~ s/\s+$//;
die "Error: Author already defined for the commit {$commit_id}\n" if defined ($pdata->{$module}{$commit_id}{'author'}); die "Error: Author already defined for the commit {$commit_id}\n" if defined ($pdata->{$module}{$commit_id}{'author'});
%{$pdata->{$module}{$commit_id}{'author'}} = (); $pdata->{$module}{$commit_id}{'author'}{'name'} = $name;
$pdata->{$module}{$commit_id}{'author'}{'name'} = "$name"; $pdata->{$module}{$commit_id}{'author'}{'email'} = $email;
$pdata->{$module}{$commit_id}{'author'}{'email'} = "$2";
next; next;
} }
...@@ -506,7 +505,6 @@ my $branch_name; ...@@ -506,7 +505,6 @@ my $branch_name;
my $git_command = "git log"; my $git_command = "git log";
my $git_cherry; my $git_cherry;
my $git_args = ""; my $git_args = "";
my $branch_name;
my %data; my %data;
my %bugs = (); my %bugs = ();
...@@ -555,7 +553,7 @@ foreach my $arg (@ARGV) { ...@@ -555,7 +553,7 @@ foreach my $arg (@ARGV) {
} }
# default log # default log
if (%generate_log == 0) { unless (%generate_log) {
$generate_log{"commits"} = 1; $generate_log{"commits"} = 1;
} }
......
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