From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web11.6056.1578137909602132421 for ; Sat, 04 Jan 2020 03:38:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cfor6Ddt; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578137908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fhqR8vZZcY1/tsG3bOQhR+0Pcm06G1UfmtQCBoItt1s=; b=Cfor6DdtOhVtDyutCrhq2slG3GYOqDNnrqwK+F/HIZqCxcAV3Zpx5toID91cIK2mRVuOZF tLUnhc4ggmmCQR2RBVKcU/6U6rLO95wP1oc719DaHvkzkLti9UwZWi7216QuRgOe8pgY0o 9201jAbiLwP6QwqJg4nMlvtyNI9fRN0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-5-OfgdcJrbOlGHYx4fSqOupQ-1; Sat, 04 Jan 2020 06:38:22 -0500 Received: by mail-wr1-f70.google.com with SMTP id y7so24475940wrm.3 for ; Sat, 04 Jan 2020 03:38:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=fhqR8vZZcY1/tsG3bOQhR+0Pcm06G1UfmtQCBoItt1s=; b=iihinEU733VuDxYSTGt8B6lnFVz4jyADbdClsUDcY+2NJFEN7hT+u9p+rWv/RoLvJW GHGfj+bPs5d8XZk0GS21GHTYrEjDMjoLCGTM69W+poqn8xkI/N6XcQwog3PVqUIXwuWO iQfruJAtbhQbkK80o5PD1Zu7BaxofZ2x0zwCLWilk0h6Dh6V8n3FROt1q9J/Wkh9RDyH qrw9qOVSIM+Pda86PsLFJa7SxDUJ3cDVp2ZYA+kC3MH6B2kPxYEP+bvxYEJx40/W9aQc wjMSBmu402bG+2m/gAV0I2+UQ/Lr1dNZhEjpKFO8s+3IaBSYkavTw6DEsQeG26m2RV/e ppqQ== X-Gm-Message-State: APjAAAV1FyicTijiPYO38YDPMn5frp4FYsK28fBinmNtL1j0vCFWta6e Gu3Z6DC8zAKKHKrb/IUel4cNlAvn/V112ClvsnjILEw2NsloBIiclVtqYuYkLjgwO2uUH3KKuI2 CnGwq1AIN2FfnNQ== X-Received: by 2002:adf:fe50:: with SMTP id m16mr89082991wrs.217.1578137901596; Sat, 04 Jan 2020 03:38:21 -0800 (PST) X-Google-Smtp-Source: APXvYqyhmpzY5tBYp3vmSWrDpY8/zf8ln78QSr9riefCSmjPoVTkPwKYd8JeQo4rLe4qzTGnInPI6g== X-Received: by 2002:adf:fe50:: with SMTP id m16mr89082973wrs.217.1578137901338; Sat, 04 Jan 2020 03:38:21 -0800 (PST) Return-Path: Received: from [192.168.1.35] (34.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.34]) by smtp.gmail.com with ESMTPSA id a184sm15822466wmf.29.2020.01.04.03.38.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Jan 2020 03:38:20 -0800 (PST) Subject: Re: [RFC PATCH 4/4] BaseTools/PatchCheck.py: Check the committer email address To: Jordan Justen , devel@edk2.groups.io Cc: Laszlo Ersek , Michael D Kinney , Liming Gao References: <20200102152553.11976-1-philmd@redhat.com> <20200102152553.11976-5-philmd@redhat.com> <157809234606.2557980.3513866584435812764@jljusten-skl> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Sat, 4 Jan 2020 12:38:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <157809234606.2557980.3513866584435812764@jljusten-skl> X-MC-Unique: OfgdcJrbOlGHYx4fSqOupQ-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 1/3/20 11:59 PM, Jordan Justen wrote: > On 2020-01-02 07:25:53, Philippe Mathieu-Daude wrote: >> To avoid patches committed with incorrect email address, >> use the EmailAddressCheck class on the committer email too. >> >> Cc: Liming Gao >> Cc: Jordan Justen >> Signed-off-by: Philippe Mathieu-Daude >> --- >> RFC because I haven't checked --pretty="%cn <%ce>" works on Windows shell. >> >> BaseTools/Scripts/PatchCheck.py | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py >> index f0e661bfd6e3..3baeb3de7ba2 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) > > I think '--pretty=%cn <%ce>' ought to work without double-quotes > because the argument is separately sent via the subprocess.Popen call. > I'm not certain it will work, but it ought to. :) Oh, this works like charm on Linux :) Thanks for the tip (and review)! Phil. >> + >> def run_git(self, *args): >> cmd = [ 'git' ] >> cmd += args >> -- >> 2.21.0 >> >