Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp9872ima; Thu, 14 Mar 2019 18:06:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsuxH1UssO0yS55i64H2pDEcg29b+ok+yafvFY0dra8eSB7mzafvVlAsZbPaFa9u0XT3wo X-Received: by 2002:a63:c04a:: with SMTP id z10mr799138pgi.115.1552611972716; Thu, 14 Mar 2019 18:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552611972; cv=none; d=google.com; s=arc-20160816; b=vgRABY+W24ju8rF09We3wiuUUQ+/bvxwhV1P7qkoqCsHf1J41gDi+Lu0q3hpJWs0/q K/0UPDUo3Yr3XTsCV3eXoYTIGJkIN99jO0JLPExR2ksBTGtEkWgptL6i2Ww+Rt9Tnxqo jr7Gcu54fMF08ZabWBjuhEJZg9nRByEiJvSt1lLv0XfLtoXD5g5Sa0Sl6JE+QSJVwwxd t6aU2+iADIqrdFOtMnc+9DHXqLPLC63yjODiRbKC4E14heUP08iTkFsqPw4Hr7sQqprG LmngIjto7GDIruSJmfct+0ZTYv83Ryea2q3rPKdySzLHCkiRPkqA0IgCdgawc52+3Uf5 M2wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=//w6DrOpXz/Vqiv8OF1diSiFKj7d6yvDZNEYGXrYI8U=; b=rtk1mZRK5Hphri5xAuRTRD5wF3p+u4ms5I9H+JLmI2DQZH4zz7CWTZ9zO8K2XQoTIX StPvQeznIrU/gmupx1jRFMi6/5nH52gQR9Hpy007/ZmueQHRVhhaYNLZQTQpBAEH5DLo VR1JxoJVJhH2XxfcLUGKhewzlwzO7s5sEo9mhrRgfQSUvEFqFMPLLmDiez2L3W0+DS0e G61ssGIHcZ73HWh9sRz7HmnOK5alntoNhsTwtUv+o6moAnJ/O3PTUbBjsiq10Kv3dKI5 iorMuOO6vCQfQsKXdeIQbRBlmKPxLJIe6la7xgSq4XseMgL0r6u54FenN0qY8Jqogovt u9Bw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 10si479606pgn.558.2019.03.14.18.05.57; Thu, 14 Mar 2019 18:06:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728105AbfCOBFU (ORCPT + 99 others); Thu, 14 Mar 2019 21:05:20 -0400 Received: from mga18.intel.com ([134.134.136.126]:59344 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727254AbfCOBFU (ORCPT ); Thu, 14 Mar 2019 21:05:20 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2019 18:05:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,480,1544515200"; d="scan'208";a="134474948" Received: from jekeller-desk.amr.corp.intel.com ([10.166.244.182]) by fmsmga007.fm.intel.com with ESMTP; 14 Mar 2019 18:05:19 -0700 From: Jacob Keller To: linux-kernel@vger.kernel.org Cc: Intel Wired LAN , netdev@vger.kernel.org, Jacob Keller , joe@perches.com Subject: [PATCH] checkpatch: fix camel case seeding when run with --root Date: Thu, 14 Mar 2019 18:03:34 -0700 Message-Id: <20190315010334.5707-1-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.18.0.219.gaf81d287a9da Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org checkpatch.pl avoids warning about camel case of some definitions by seeding a file that tracks all of the currently committed camel case definitions. To build this seed file, checkpatch.pl decides between using git or the --root parameter. This works as long as you don't run checkpatch.pl from within a different git tree that is not the Linux kernel. In this case, the check for ".git" will return true, and checkpatch will attempt to seed a camel case file using the current directory. This works fine if --root is not provided, but can result in an incorrect camel case seed file resulting in false positive warnings. Fix this by checking for $root/.git instead, so that we use the --root parameter properly when seeding the camel case list. Additionally, when generating the list of files to be checked, prefix the $root path so that the correct file will be found. These changes allow checkpatch.pl to honor the --root parameter even if being run from within another git repository. Signed-off-by: Jacob Keller --- (Resending with a not-invalid address for the netdev mailing list...) scripts/checkpatch.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d0001fd1112d..358add495e18 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -903,8 +903,8 @@ sub seed_camelcase_includes { $camelcase_seeded = 1; - if (-e ".git") { - my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`; + if (-e "$root/.git") { + my $git_last_include_commit = `cd $root && git log --no-merges --pretty=format:"%h%n" -1 -- include`; chomp $git_last_include_commit; $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit"; } else { @@ -931,9 +931,10 @@ sub seed_camelcase_includes { return; } - if (-e ".git") { - $files = `git ls-files "include/*.h"`; + if (-e "$root/.git") { + $files = `cd $root && git ls-files "include/*.h"`; @include_files = split('\n', $files); + @include_files = map("$root/$_", @include_files); } foreach my $file (@include_files) { -- 2.18.0.219.gaf81d287a9da