]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/PatchCheck.py: Check the committer email address
authorPhilippe Mathieu-Daude <philmd@redhat.com>
Thu, 9 Jan 2020 10:55:46 +0000 (18:55 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 10 Jan 2020 04:06:42 +0000 (04:06 +0000)
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>
BaseTools/Scripts/PatchCheck.py

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