Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753161AbdDKSjL (ORCPT ); Tue, 11 Apr 2017 14:39:11 -0400 Received: from smtprelay0018.hostedemail.com ([216.40.44.18]:37293 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752002AbdDKSjK (ORCPT ); Tue, 11 Apr 2017 14:39:10 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:967:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:2902:3138:3139:3140:3141:3142:3353:3622:3653:3865:3866:3867:3868:3870:3871:3872:3874:4321:4605:5007:7576:8957:9010:10004:10400:10848:11026:11232:11658:11914:12043:12438:12555:12740:12760:12895:13069:13095:13161:13229:13311:13357:13439:14181:14659:14721:14777:21080:21433:30022:30054:30070:30080:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: bikes45_89f0c78945a19 X-Filterd-Recvd-Size: 2325 Message-ID: <1491935946.17839.18.camel@perches.com> Subject: Re: [PATCH] checkpatch: special audit for revert commit line From: Joe Perches To: Wei Wang , apw@canonical.com, Andrew Morton Cc: linux-kernel@vger.kernel.org Date: Tue, 11 Apr 2017 11:39:06 -0700 In-Reply-To: <20170411174140.89291-1-wvw@google.com> References: <20170411174140.89291-1-wvw@google.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.3-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1521 Lines: 42 On Tue, 2017-04-11 at 10:41 -0700, Wei Wang wrote: > From: Wei Wang > > Currently checkpatch.pl does not recognize revert commits and > complains about the commit hash format. > Add special audit for revert commit to fix it. The commit wording seems a bit off, but I guess it's OK. The 'This reverts commit .' is git's default commit revert message. There are many uses that contain additional content after the sha1 in git log so perhaps using $line !~ /^This reverts commit [0-9a-f]{7,40}/ is more robust/better. $ git log --format=email --grep=revert -i -100000 | \ grep "This reverts commit" | \ sed -r 's/This reverts commit [0-9a-f]{12,40}\.?//' | \ sort | uniq > Signed-off-by: Wei Wang > --- > scripts/checkpatch.pl | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index baa3c7be04ad..60c3b9e6a46b 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -2539,6 +2539,7 @@ sub process { > # Check for git id commit length and improperly formed commit descriptions > if ($in_commit_log && !$commit_log_possible_stack_dump && > $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink):/i && > + $line !~ /^This reverts commit [0-9a-f]{12,40}\./ && > ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || > ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i && > $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&