public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: devel@edk2.groups.io
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Philippe Mathieu-Daude <philmd@redhat.com>,
	Liming Gao <liming.gao@intel.com>,
	Jordan Justen <jordan.l.justen@intel.com>
Subject: [PATCH v2 4/4] BaseTools/PatchCheck.py: Check the committer email address
Date: Mon,  6 Jan 2020 11:35:28 +0100	[thread overview]
Message-ID: <20200106103528.5438-5-philmd@redhat.com> (raw)
In-Reply-To: <20200106103528.5438-1-philmd@redhat.com>

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

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@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


  parent reply	other threads:[~2020-01-06 10:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 10:35 [PATCH v2 0/4] BaseTools/PatchCheck: Check committer/author email addresses Philippe Mathieu-Daudé
2020-01-06 10:35 ` [PATCH v2 1/4] BaseTools/PatchCheck.py: Extract email check code to EmailAddressCheck Philippe Mathieu-Daudé
2020-01-06 10:35 ` [PATCH v2 2/4] BaseTools/PatchCheck.py: Let EmailAddressCheck describe email checked Philippe Mathieu-Daudé
2020-01-06 10:35 ` [PATCH v2 3/4] BaseTools/PatchCheck.py: Check the patch author email address Philippe Mathieu-Daudé
2020-01-06 10:35 ` Philippe Mathieu-Daudé [this message]
2020-01-09  9:50 ` [edk2-devel] [PATCH v2 0/4] BaseTools/PatchCheck: Check committer/author email addresses Bob Feng
2020-01-09 10:39   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200106103528.5438-5-philmd@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox