From 249b6a552b00637ae7ad3dcb8d797befba1734ad Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Sat, 29 Apr 2017 19:15:26 +0200 Subject: 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 --- bin/lo-commit-stat | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'bin') diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat index 4ad9f013935f..2e42d468b40d 100755 --- a/bin/lo-commit-stat +++ b/bin/lo-commit-stat @@ -4,6 +4,7 @@ #!/usr/bin/perl use strict; +use warnings; use LWP::UserAgent; use utf8; use File::Temp; @@ -157,26 +158,24 @@ sub load_git_log($$$$$$$) # } open (GIT, "$cmd 2>&1|") || die "Can't run $cmd: $!"; - %{$pdata->{$module}} = (); while (my $line = ) { chomp $line; if ( $line =~ m/^commit ([0-9a-z]{20})/ ) { - $commit_id = "$1"; + $commit_id = $1; $summary=undef; - %{$pdata->{$module}{"$commit_id"}} = (); next; } if ( $line =~ /^Author:\s*([^\<]*)\<([^\>]*)>/ ) { # get rid of extra empty spaces; - my $name = "$1"; + my $name = $1; + my $email = $2; $name =~ s/\s+$//; 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'}{'email'} = "$2"; + $pdata->{$module}{$commit_id}{'author'}{'name'} = $name; + $pdata->{$module}{$commit_id}{'author'}{'email'} = $email; next; } @@ -506,7 +505,6 @@ my $branch_name; my $git_command = "git log"; my $git_cherry; my $git_args = ""; -my $branch_name; my %data; my %bugs = (); @@ -555,7 +553,7 @@ foreach my $arg (@ARGV) { } # default log -if (%generate_log == 0) { +unless (%generate_log) { $generate_log{"commits"} = 1; } -- cgit