From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58864C433DF for ; Sun, 18 Oct 2020 16:07:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2253520773 for ; Sun, 18 Oct 2020 16:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726868AbgJRQHh (ORCPT ); Sun, 18 Oct 2020 12:07:37 -0400 Received: from smtprelay0187.hostedemail.com ([216.40.44.187]:44952 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725776AbgJRQHg (ORCPT ); Sun, 18 Oct 2020 12:07:36 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 8F1BF18224956; Sun, 18 Oct 2020 16:07:35 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: corn47_3708b142722f X-Filterd-Recvd-Size: 2939 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA; Sun, 18 Oct 2020 16:07:34 +0000 (UTC) Message-ID: Subject: Re: [PATCH] checkpatch: Allow not using -f with files that are in git From: Joe Perches To: Geert Uytterhoeven , Linus Torvalds Cc: Andrew Morton , Andy Whitcroft , LKML Date: Sun, 18 Oct 2020 09:07:33 -0700 In-Reply-To: References: <45b81a48e1568bd0126a96f5046eb7aaae9b83c9.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2020-10-18 at 16:03 +0200, Geert Uytterhoeven wrote: > Hi Joe, > > On Tue, Aug 25, 2020 at 2:12 AM Joe Perches wrote: > > If a file exists in git and checkpatch is used without the -f > > flag for scanning a file, then checkpatch will scan the file > > assuming it's a patch and emit: > > > > ERROR: Does not appear to be a unified-diff format patch > > > > Change the behavior to assume the -f flag if the file exists > > in git. > > > > Signed-off-by: Joe Perches > > Thanks for your patch! > > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -976,6 +976,16 @@ sub seed_camelcase_includes { > > } > > } > > > > +sub git_is_single_file { > > + my ($filename) = @_; > > + > > + return 0 if ((which("git") eq "") || !(-e "$gitroot")); > > + > > + my $output = `${git_command} ls-files -- $filename`; > > + my $count = $output =~ tr/\n//; > > + return $count eq 1 && $output =~ m{^${filename}$}; > > +} > > + > > sub git_commit_info { > > my ($commit, $id, $desc) = @_; > > > > This is now commit f5f613259f3fea81 ("checkpatch: allow not using -f > with files that are in git"), causing: > > Global symbol "$gitroot" requires explicit package name (did you > forget to declare "my $gitroot"?) at scripts/checkpatch.pl line 980. > Execution of scripts/checkpatch.pl aborted due to compilation errors. > > FWIW, host system is running Ubuntu 18.04.5 LTS (upgrade to 20.04 LTS > planned soon ;-). I believe there is a dependency on another patch in -next that wasn't pushed to Linus' tree. commit 5ec1f7de97b26a3fa364bbb31fdd2e42c8e6fa22 Author: Joe Perches Date: Thu Oct 8 11:53:44 2020 +1100 checkpatch: test $GIT_DIR changes So it'd be better to revert right now until this other patch is accepted or pushed.