Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp254243pxb; Mon, 13 Sep 2021 18:29:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7qiMCKB5iFywnquKaLuktfuqoijp5Xi2flJjMzOcgPqGtjolUzGNQHV+MnJPuLDrxqGJe X-Received: by 2002:a6b:d915:: with SMTP id r21mr11485869ioc.76.1631582944732; Mon, 13 Sep 2021 18:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631582944; cv=none; d=google.com; s=arc-20160816; b=H56F+nnZsVh3qDnX0gPkdQEpoueUa8hTMPYhJ2d6gG3/aEgoYlvNioW5RSLpt3WDZ5 OH2/knXbpzUacDmQY7JVnavqqAkef8D5SY90H/6ptmGdjw5S0De5InM/LEDhUFaLpUrU bczxCySZoxZBVB4DXLngHcw1qlaqPQrE6sC+47o4Vu54L5x4gosLGqmopShF2P0R7hyH gfmMbAaqL98pkgciOM6RZolkZrxN+pzlUlqpli4ha4NDfI3MOgE/KltIzniDdmYcNWir uUhLYlESXKIOCvfUxzDxmqsxbbzQiMWBgqmTwRyD9b4yY1iI8SbEmm3LGSzxMyzX9Z9t fjJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=0Y0FJaNZSCUHBQ+fPBNDuJMCC4vLwAceS4k6e2oEzTI=; b=PWo4Sa7hYorLAr8UXesf19D5ulJg/cjsGUcJNDaGHkKCdfF47OjtDrcpnmAJfZ8HNO xRSqNsOG37FCyrllCi+4u2rIcIVZAXtXCiJ9gcWlxI3i05fx/5hHWMG7Xu7JDDdGu2w8 yeMqVKRBvFqXBaptqvRtufUDDN5YsDQmwwvwlEjZbCved2fowGydjR0J8rL2ufh9I+/3 lAGRWVImWdIaJ7B9JxYJipWsaCCcfXnSZA4Hed8CGK+LREZLDaJRdQP7FIYyCYzXBTpv eKdGQK8BI6JiVsLuVvYJztZguE4/R/M746H2O+3Zv4rlvCOSOGJ7z8pMgeyntYSZECST QSaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=rhfks4k8; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si7709992jae.21.2021.09.13.18.28.53; Mon, 13 Sep 2021 18:29:04 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=rhfks4k8; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242873AbhIMXfg (ORCPT + 99 others); Mon, 13 Sep 2021 19:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243754AbhIMXfP (ORCPT ); Mon, 13 Sep 2021 19:35:15 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43A59C061574 for ; Mon, 13 Sep 2021 16:33:36 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id ib9-20020a0562141c8900b003671c3a1243so58901406qvb.21 for ; Mon, 13 Sep 2021 16:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=0Y0FJaNZSCUHBQ+fPBNDuJMCC4vLwAceS4k6e2oEzTI=; b=rhfks4k8tFJpfDygh87cLnVtYjz8ukOMJzU+cQgjOrQK9p2isZjg59tGhZxAKa9n0g cC/Cfh594aAVQKc9izkjZvaaKvIOb9WBzU7JWJvUgq1WQB7VuiOghxgfCHCLhPF573mZ caK21nI63Tn2iLqq+YEuYTmOyr0go55vFWTuDq22JwHuFZtp2UlXlNjGC+HE2FF1gCHR aqH8g5N+AHhhEUuBCF6dtiR6GdMgb0y4G9F3DsYCVx9CcSMycbOlUkeXPAr5vI9HaPt/ WTfFTHHhsfh+Fo9H5zkI+vJeLN0EBBegNfMUCktXaSlKfbl991tkMXrcl59Ha2a74Na3 IX1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=0Y0FJaNZSCUHBQ+fPBNDuJMCC4vLwAceS4k6e2oEzTI=; b=ajQQ51IgVlvbrLHoaxPTUbxo1mKVHapuSsQ45UKFlFBo+Bt7PyamTQRJuFdVj7hhVO dy+XT4cmmBK1DOUPzvyB7rf1zsH1Cje9mnvE/pMgMoDkKkNePRz32SkEebodiRAmcfrt eudnaMPKTqnFiN6zelUgu/nW47xpj1DOk6xZRfZAv7irkbDpITAi/47sIlGVq0+E1ztT xpo7KQ7OelHvsmvriRZYE8OBz8Iuu7/Te2a0oIqBAq+Octk88Iyprpg1a4KhR1HMa5vE TMBmv2O+iUUfB1i1iCdGkLqQ/zZolpllSA9VlOL8QIRlQXcQ8VtQcoEaUSVmglP66Oga s2HQ== X-Gm-Message-State: AOAM531ZkV4DkMuo7+I/K27fK9fiIVXStCaJ7umP+D2z4tQaPRIJlFNE zr10+rxLz2evUrEUuNbJhLsOiq4= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:200:f533:d5d5:c2b4:c981]) (user=pcc job=sendgmr) by 2002:ad4:4aa8:: with SMTP id i8mr2255539qvx.59.1631576015445; Mon, 13 Sep 2021 16:33:35 -0700 (PDT) Date: Mon, 13 Sep 2021 16:33:24 -0700 Message-Id: <20210913233325.23263-1-pcc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.309.g3052b89438-goog Subject: [PATCH] checkpatch.pl: use correct gitroot when running from non-top-level dir From: Peter Collingbourne To: Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn Cc: Peter Collingbourne , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org My workflow usually requires running checkpatch.pl from a subdirectory of the kernel source tree. This works for the most part, but the script will be unable to find the .git directory and will therefore refuse to run any git commands (so, e.g. commit ID verification will fail). Fix it by prepending $root to $gitroot when a root is set. This also requires fixing one root directory assumption in a git invocation. Signed-off-by: Peter Collingbourne Link: https://linux-review.googlesource.com/id/I33dc5f38e2bfcd95c8ea59933bba5305cce50404 --- scripts/checkpatch.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c27d2312cfc3..171c5993efb4 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -434,6 +434,8 @@ if ($tree) { print "Must be run from the top-level dir. of a kernel tree\n"; exit(2); } + + $gitroot = "$root/$gitroot"; } my $emitted_corrupt = 0; @@ -1131,7 +1133,7 @@ sub seed_camelcase_includes { } if (-e "$gitroot") { - $files = `${git_command} ls-files "include/*.h"`; + $files = `${git_command} ls-files "$root/include/*.h"`; @include_files = split('\n', $files); } -- 2.33.0.309.g3052b89438-goog