diff options
-rwxr-xr-x | src/build/tools/addCopyright.pl | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/build/tools/addCopyright.pl b/src/build/tools/addCopyright.pl index 3a922b3e0..000958c1e 100755 --- a/src/build/tools/addCopyright.pl +++ b/src/build/tools/addCopyright.pl @@ -1161,23 +1161,21 @@ sub getFileContributors my $gitAuthors = `git log --follow --find-copies-harder -C85% -M85% --pretty="%aN <%aE>" -- $filename | sort | uniq`; my @gitAuthors = split('\n', $gitAuthors); - # Add current commiter. + # Get commit's author # If running copyright_check run 'git log' as a commit is not taking place - # Otherwise check using 'git config' as this is a pre-commit hook - my $curAuthorEmail = ""; - if ($copyright_check) - { - $curAuthorEmail = `git log -n1 --pretty=format:"%aN <%aE>"`; - chomp($curAuthorEmail); - } - else + # Else we currently have no way of getting the current author. Because + # this is a pre-commit hook, the commit staged to be committed does not + # show up in 'git log' until commit has completed. We cannot look up + # current user's info because the user pushing the commit may not be + # the author. + + if($copyright_check) { - my $curAuthorName = `git config user.name`; - $curAuthorEmail = `git config user.email`; + my $curAuthorEmail = `git log -n1 --pretty=format:"%aN <%aE>"`; chomp($curAuthorEmail); - $curAuthorEmail = "$curAuthorName <".$curAuthorEmail.">"; + push(@gitAuthors, $curAuthorEmail); } - push(@gitAuthors, $curAuthorEmail); + foreach my $contributor (@gitAuthors) { my $companyExists = 0; |