BaseTools/PatchCheck.py: Check the committer email address

To avoid patches committed with incorrect email address,
use the EmailAddressCheck class on the committer email too.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
This commit is contained in:
Philippe Mathieu-Daude 2020-01-09 18:55:46 +08:00 committed by mergify[bot]
parent 8ffa47fb3a
commit 8f38b08b50
1 changed files with 6 additions and 0 deletions

View File

@ -552,6 +552,8 @@ class CheckGitCommits:
else:
blank_line = True
print('Checking git commit:', commit)
email = self.read_committer_email_address_from_git(commit)
self.ok &= EmailAddressCheck(email, 'Committer').ok
patch = self.read_patch_from_git(commit)
self.ok &= CheckOnePatch(commit, patch).ok
if not commits:
@ -570,6 +572,10 @@ class CheckGitCommits:
# Run git to get the commit patch
return self.run_git('show', '--pretty=email', '--no-textconv', commit)
def read_committer_email_address_from_git(self, commit):
# Run git to get the committer email
return self.run_git('show', '--pretty=%cn <%ce>', '--no-patch', commit)
def run_git(self, *args):
cmd = [ 'git' ]
cmd += args