[edk2-devel] [PATCH v2 4/4] BaseTools/PatchCheck.py: Check the committer email address

Philippe Mathieu-Daudé philmd at redhat.com
Mon Jan 6 10:35:28 UTC 2020


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

Cc: Liming Gao <liming.gao at intel.com>
Cc: Jordan Justen <jordan.l.justen at intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd at redhat.com>
---
v2: Do not use "" because we use subprocess.Popen (Jordan Justen)
---
 BaseTools/Scripts/PatchCheck.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index f0e661bfd6e3..c5f2f89e4d4c 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -560,6 +560,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:
@@ -578,6 +580,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
-- 
2.21.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52889): https://edk2.groups.io/g/devel/message/52889
Mute This Topic: https://groups.io/mt/69462077/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list