Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3104628ybt; Mon, 22 Jun 2020 15:16:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwMo8F7wxfE5S9Ts1STjx/J/9BYfdQ0FJFXHdfgqKtH4xQ+XmozcvJd1qDgcnVoEPPUVNX X-Received: by 2002:a17:906:490f:: with SMTP id b15mr17054805ejq.180.1592864168250; Mon, 22 Jun 2020 15:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592864168; cv=none; d=google.com; s=arc-20160816; b=gqzXOpSxhoIMYxnlLwZEe/R8hpY5k5uYrTtkSN022NjC9eXj97rwIIhndeYU64RiT9 0DjxLqqaW5CumTd5Hl2fOCvYAg5AdfF4t7zEGq7rgyGkPNd8gc5VYlVMT5DGscuqXVsU Dp9ZIrvlxIHYbz+vA42Z3YhQOPxfh9SgOv1tpJMXOkxHUDfkX3gTOe0Iq9NttbQ8Y55G JNV2VCmXOGTFuw34xKuUiEL3ms2S68AWW3KjjcqrnE3s2FbO1o0N+8gOk6eolaSsPNjr zlojAXIt58qFRMAQv34SgKtNum2OZ3OVxW6wdvWw92fZkEBCCmqV8PlOPs39GpRpPdpf tUDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=FLHatkao1Mx6NGjI6AM2bN2dzi/504w+bLWhbeJ69PY=; b=yfg8kX26cMFXFeEwNDzIuRfSiTy5mySVOVRE9nlmhmafdYuErXum2d3wyH9v6UvTHA cWAHVIpjV1Hv7OhnT4Drn3QddmIC91J5VaCOenYXPWy0Fvyu1nyGCNZ2l9SB87Bmxh1g M/Ls5KgH0mKUsQjjjSjhtdENaLo5Ljz5LF3qashSHoUH8xNEKkH7j6HkkrpwR1QYAl7G yoP67T1yyXDbDp5ERHddzTA+sg/IB13oRLSBoz0TBG7051Z10OWi4zgvvi0eu0/xjyfg llJvZYKaGxRuwA+e/XjozjxuEduV1LCzoEaEhUIps95QRgbDgSwmuvoJ8AoPaGNHCslU fwuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz19si9791262edb.40.2020.06.22.15.15.45; Mon, 22 Jun 2020 15:16:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730992AbgFVWL1 (ORCPT + 99 others); Mon, 22 Jun 2020 18:11:27 -0400 Received: from smtprelay0046.hostedemail.com ([216.40.44.46]:48118 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727018AbgFVWL1 (ORCPT ); Mon, 22 Jun 2020 18:11:27 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id F1C8B837F24C; Mon, 22 Jun 2020 22:11:25 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2693:2731:2828:3138:3139:3140:3141:3142:3353:3622:3653:3865:3866:3867:3868:3870:3871:4321:5007:7875:7903:9010:10004:10400:10450:10455:10848:11026:11232:11658:11914:12043:12296:12297:12438:12740:12760:12895:13069:13311:13357:13439:14181:14659:14721:19904:19999:21080:21324:21627:21990:30054: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:1,LUA_SUMMARY:none X-HE-Tag: bird05_4200e1f26e36 X-Filterd-Recvd-Size: 2763 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf15.hostedemail.com (Postfix) with ESMTPA; Mon, 22 Jun 2020 22:11:24 +0000 (UTC) Message-ID: Subject: Re: [PATCH] checkpatch: use $root/.git when seeding camel case From: Joe Perches To: Jacob Keller , linux-kernel@vger.kernel.org Cc: Andrew Morton Date: Mon, 22 Jun 2020 15:11:23 -0700 In-Reply-To: <20200622215834.2858106-1-jacob.e.keller@intel.com> References: <20200622215834.2858106-1-jacob.e.keller@intel.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.2-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-06-22 at 14:58 -0700, Jacob Keller wrote: > When seeding the camel case file, checkpatch.pl uses the $root directory > in order to find the acceptable list of allowed camel case words. > > However, if the current directory is a git repository, checkpatch.pl > attempts to seed using the local git directory. > > This is problematic if checkpatch.pl is passed a --root and is being run > from within another git repository. Rather than seeding from the > provided root tree, checkpatch.pl will seed using the local files. If > the current git repository isn't a kernel tree, this can lead to > unexpected warnings about camel case issues. > > Always honor the $root parameter when seeding camelcase files by using > "$root/.git" and changing directory to the $root before invoking git. [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -919,8 +919,8 @@ sub seed_camelcase_includes { > > $camelcase_seeded = 1; > > - if (-e ".git") { > - my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`; > + if (-e "$root/.git") { > + my $git_last_include_commit = `cd $root && ${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`; > chomp $git_last_include_commit; > $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit"; > } else { > @@ -947,9 +947,10 @@ sub seed_camelcase_includes { > return; > } > > - if (-e ".git") { > - $files = `${git_command} ls-files "include/*.h"`; > + if (-e "$root/.git") { > + $files = `cd $root && ${git_command} ls-files "include/*.h"`; > @include_files = split('\n', $files); > + @include_files = map("$root/$_", @include_files); > } > > foreach my $file (@include_files) { checkpatch has 4 uses of ${git_command} Maybe git_command should be changed instead. I wonder how this interacts with the GIT_DIR environment variable.