Re: [PATCH -next] get_maintainer: Improve "Author:" rolestats
From: Chen Gang
Date: Mon Nov 04 2013 - 21:38:25 EST
On 11/05/2013 10:22 AM, Chen Gang wrote:
> On 11/05/2013 05:54 AM, Joe Perches wrote:
>> Add this to "try this"...
>>
>> Chen Gang's defect is because his git repository branch
>> had a commit he authored but where did not add his signature.
>>
Hmm... in fact, when I make a patch, I really let "git log" contents a
commit I author but where do not add my signature.
But after I let it pure next-20131101 ("git reset HEAD^; git stash"), it
still cause this issue.
>
> Hmm... for pure next-20131101 tree in my git directory and the demo
> patches in attachment, it will cause this issue.
>
> And excuse me, I am not quite familiar with git, could you provide more
> details (e.g. where the special difference of the demo patches or the
> pure next-20131101 tree in my git directory)? thanks.
>
>> Also, there's a defect in function vcs_find_signers.
>> It should only return the commit count and array references.
>>
>> If there are no signers in the commit history interval specified,
>> then the "authors" array is added to the "signers" array and
>> returned as a single array.
>>
>> Use references instead.
>>
>> Make sure that references are defined in the places
>> that vcs_find_signers is called.
>>
>
> After apply the patch below, it can work well.
>
> Tested-by Chen Gang <gang.chen@xxxxxxxxxxx>
>
>
>
>> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
>> ---
>> scripts/get_maintainer.pl | 21 +++++++++++----------
>> 1 file changed, 11 insertions(+), 10 deletions(-)
>>
>> diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
>> index ee9adb8..9c3986f 100755
>> --- a/scripts/get_maintainer.pl
>> +++ b/scripts/get_maintainer.pl
>> @@ -128,7 +128,7 @@ my %VCS_cmds_git = (
>> "blame_commit_pattern" => "^([0-9a-f]+) ",
>> "author_pattern" => "^GitAuthor: (.*)",
>> "subject_pattern" => "^GitSubject: (.*)",
>> - "stat_pattern" => "(\\d+)\\t(\\d+)\\t\$file",
>> + "stat_pattern" => "^(\\d+)\\t(\\d+)\\t\$file\$",
>> );
>>
>> my %VCS_cmds_hg = (
>> @@ -156,7 +156,7 @@ my %VCS_cmds_hg = (
>> "blame_commit_pattern" => "^([ 0-9a-f]+):",
>> "author_pattern" => "^HgAuthor: (.*)",
>> "subject_pattern" => "^HgSubject: (.*)",
>> - "stat_pattern" => "(\\d+)\t(\\d+)\t\$file",
>> + "stat_pattern" => "^(\\d+)\t(\\d+)\t\$file\$",
>> );
>>
>> my $conf = which_conf(".get_maintainer.conf");
>> @@ -1297,7 +1297,7 @@ sub vcs_find_signers {
>>
>> # print("stats: <@stats>\n");
>>
>> - return (0, @signatures, @authors) if !@signatures;
>> + return (0, \@signatures, \@authors, \@stats) if !@signatures;
>>
>> save_commits_by_author(@lines) if ($interactive);
>> save_commits_by_signer(@lines) if ($interactive);
>> @@ -1880,9 +1880,10 @@ sub vcs_file_signoffs {
>> $cmd =~ s/(\$\w+)/$1/eeg; # interpolate $cmd
>>
>> ($commits, $signers_ref, $authors_ref, $stats_ref) = vcs_find_signers($cmd, $file);
>> - @signers = @{$signers_ref};
>> - @authors = @{$authors_ref};
>> - @stats = @{$stats_ref};
>> +
>> + @signers = @{$signers_ref} if defined $signers_ref;
>> + @authors = @{$authors_ref} if defined $authors_ref;
>> + @stats = @{$stats_ref} if defined $stats_ref;
>>
>> # print("commits: <$commits>\nsigners:<@signers>\nauthors: <@authors>\nstats: <@stats>\n");
>>
>> @@ -1965,8 +1966,8 @@ sub vcs_file_blame {
>> $cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd
>>
>> ($commit_count, $commit_signers_ref, $commit_authors_ref, $stats_ref) = vcs_find_signers($cmd, $file);
>> - @commit_authors = @{$commit_authors_ref};
>> - @commit_signers = @{$commit_signers_ref};
>> + @commit_authors = @{$commit_authors_ref} if defined $commit_authors_ref;
>> + @commit_signers = @{$commit_signers_ref} if defined $commit_signers_ref;
>>
>> push(@signers, @commit_signers);
>> } else {
>> @@ -1983,8 +1984,8 @@ sub vcs_file_blame {
>> $cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd
>>
>> ($commit_count, $commit_signers_ref, $commit_authors_ref, $stats_ref) = vcs_find_signers($cmd, $file);
>> - @commit_authors = @{$commit_authors_ref};
>> - @commit_signers = @{$commit_signers_ref};
>> + @commit_authors = @{$commit_authors_ref} if defined $commit_authors_ref;
>> + @commit_signers = @{$commit_signers_ref} if defined $commit_signers_ref;
>>
>> push(@signers, @commit_signers);
>> }
>>
>>
>>
>>
>
>
--
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/