Message ID | 20221224155138.447912-2-masahiroy@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp209387wrt; Sat, 24 Dec 2022 07:58:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXvY/XRfYEjeIDkQiEA0L3PXQMsIAhi0GRljtxa/wGba7/BAl4QYRPCq3RoITUZEz6PLDNx1 X-Received: by 2002:a17:907:c386:b0:82b:423b:b61c with SMTP id tm6-20020a170907c38600b0082b423bb61cmr11349428ejc.9.1671897530582; Sat, 24 Dec 2022 07:58:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671897530; cv=none; d=google.com; s=arc-20160816; b=tzHU0nmGrPjgE2p9z1gNLfWmbcXzSToQKLKj7m2gVINQLX5ZfbJ5gNk5CUyERJ8w62 qkysPKhFXRY/tcLSQMQLcem48khDQ/3m66jz89krjC96BvFoM86cjjWn41cb0Upz9uYL +4UqEANiecUB8dakux83BthVvZWCMLH2x8sTg+wLhHHtWmgPld5Uo85faCGJOdh5HXvi 0yGJSBOAJF2Nu7fsINurVnZP/2FgSONo8lnqh5KJrOn27hDg5Ua5oTjXLMPnGRFH0RfN 2as6REeXgb+HAM+lmi3iZNVRT4CEPRThO5/lGIesR26gfF7oKwjpSlTQC33TU6AWyBgI LmcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xOZpnpTaZgbJnriAFH701QslkOhV3UvzcmsWx03AIok=; b=VAra070pNDSATN9M0BP7xTANF8SQwyb7k6ytrLKpW4sAGNYebNvAwGjZlaEPNFNtDE uSMXXQC9MwV7sPWQhcAghDEr5YRK7rPsHxLpilghn4eyaOxjNjZTGJ9tpHtxWBqZKBxs +twmDbR/9OpzNc7pgmZozCCQhBt3KsM9jus41oApqd948yw58W5rVaEvloaqhKMM9eL+ EReeiFYw/tPQJwwkcPTtNavgjw/MxWjGJFstsEXnELWK8njctTf1byHpVl1wFLpsXCwa d1FsomHJ8XjmfQXKCBnV0vSo3EKfcczI1qFTRnKIMslrkC1ptdaSVZE+Oy4mEfXC6a7e rBzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ow41Lbuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb10-20020a170907070a00b007c1052c9243si5438296ejb.15.2022.12.24.07.58.26; Sat, 24 Dec 2022 07:58:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ow41Lbuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231237AbiLXPvu (ORCPT <rfc822;eddaouddi.ayoub@gmail.com> + 99 others); Sat, 24 Dec 2022 10:51:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231205AbiLXPvr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 24 Dec 2022 10:51:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463ACB4A4; Sat, 24 Dec 2022 07:51:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D2E1E60AB3; Sat, 24 Dec 2022 15:51:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBA8FC433F1; Sat, 24 Dec 2022 15:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671897105; bh=yg//8hD31XxiPCoRTUQMtdjbNNcNmuW0h+F67eoF5Vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ow41Lbuwc2FXdptY6AZ12z+BryyyBJC8Y5LrrrRihCwZGr/MC3fwQs7gwCEzY1vo1 b0bHIoipBUMTXHlqf2QTQeiyEbsru/oy1VFfHm3lVNwgf3pwCh3DjhyzX+Xd9ItS7N 4o6/Oy+pfI9NcUvwTART4udJqHGR004SMlED8kQL4kjtVLDZdyYkJSTo+08XRTwWqb qUYxTGnjpfunoG1DdhISAXdsTcWDxXlnDK4g2ai9tF+embm2bf9r+UOoI1KCn1ppo5 9fzbIlArpJeEPuQ8gOz0SNPdyJPcEloJNsnnTPbikCA/quMMVHI0HiDmvimHA0N1os kkire3ci1fCLg== From: Masahiro Yamada <masahiroy@kernel.org> To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Nicolas Schier <nicolas@fjasle.eu> Subject: [PATCH v2 2/2] kbuild: make W=1 warn files that are tracked but ignored by git Date: Sun, 25 Dec 2022 00:51:38 +0900 Message-Id: <20221224155138.447912-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224155138.447912-1-masahiroy@kernel.org> References: <20221224155138.447912-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753111625309767599?= X-GMAIL-MSGID: =?utf-8?q?1753111625309767599?= |
Series |
[v2,1/2] .gitinogre: update the command to check tracked files being ignored
|
|
Commit Message
Masahiro Yamada
Dec. 24, 2022, 3:51 p.m. UTC
The top .gitignore comments about how to detect files breaking
.gitignore rules, but people rarely care about it.
Add a new W=1 warning to detect files that are tracked but ignored by
git. If git is not installed or the source tree is not tracked by git
at all, this script does not print anything.
Running it on the v6.1 kernel detected the following:
$ make W=1 misc-check
Documentation/devicetree/bindings/.yamllint: warning: ignored by one of the .gitignore files
drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files
drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files
drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files
fs/ext4/.kunitconfig: warning: ignored by one of the .gitignore files
fs/fat/.kunitconfig: warning: ignored by one of the .gitignore files
kernel/kcsan/.kunitconfig: warning: ignored by one of the .gitignore files
lib/kunit/.kunitconfig: warning: ignored by one of the .gitignore files
mm/kfence/.kunitconfig: warning: ignored by one of the .gitignore files
tools/testing/selftests/arm64/tags/.gitignore: warning: ignored by one of the .gitignore files
tools/testing/selftests/arm64/tags/Makefile: warning: ignored by one of the .gitignore files
tools/testing/selftests/arm64/tags/run_tags_test.sh: warning: ignored by one of the .gitignore files
tools/testing/selftests/arm64/tags/tags_test.c: warning: ignored by one of the .gitignore files
These are ignored by the '.*' or 'tags' in the top .gitignore, but
there is no rule to negate it.
You might be tempted to do 'git add -f' but I want to have the real
issue fixed (by fixing a .gitignore, or by renaming files, etc.).
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Changes in v2:
- Add $(srctree)/ to make it work with O=
Makefile | 6 ++++++
scripts/misc-check | 19 +++++++++++++++++++
2 files changed, 25 insertions(+)
create mode 100755 scripts/misc-check
Comments
Hi Masahiro, I love your patch! Perhaps something to improve: [auto build test WARNING on masahiroy-kbuild/for-next] [also build test WARNING on masahiroy-kbuild/fixes linus/master v6.1 next-20221220] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Masahiro-Yamada/kbuild-make-W-1-warn-files-that-are-tracked-but-ignored-by-git/20221224-235253 base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next patch link: https://lore.kernel.org/r/20221224155138.447912-2-masahiroy%40kernel.org patch subject: [PATCH v2 2/2] kbuild: make W=1 warn files that are tracked but ignored by git config: openrisc-randconfig-r024-20221225 compiler: or1k-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/906c2c5c0c3230103325b146ec511fbb18d57cd1 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Masahiro-Yamada/kbuild-make-W-1-warn-files-that-are-tracked-but-ignored-by-git/20221224-235253 git checkout 906c2c5c0c3230103325b146ec511fbb18d57cd1 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=openrisc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=openrisc SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> Documentation/devicetree/bindings/.yamllint: warning: ignored by one of the .gitignore files >> drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files >> drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files >> drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files >> fs/ext4/.kunitconfig: warning: ignored by one of the .gitignore files >> fs/fat/.kunitconfig: warning: ignored by one of the .gitignore files >> kernel/kcsan/.kunitconfig: warning: ignored by one of the .gitignore files >> lib/kunit/.kunitconfig: warning: ignored by one of the .gitignore files >> mm/kfence/.kunitconfig: warning: ignored by one of the .gitignore files >> tools/testing/selftests/arm64/tags/.gitignore: warning: ignored by one of the .gitignore files >> tools/testing/selftests/arm64/tags/Makefile: warning: ignored by one of the .gitignore files >> tools/testing/selftests/arm64/tags/run_tags_test.sh: warning: ignored by one of the .gitignore files >> tools/testing/selftests/arm64/tags/tags_test.c: warning: ignored by one of the .gitignore files
On Sun, Dec 25, 2022 at 12:51:38AM +0900, Masahiro Yamada wrote: > The top .gitignore comments about how to detect files breaking > .gitignore rules, but people rarely care about it. > > Add a new W=1 warning to detect files that are tracked but ignored by > git. If git is not installed or the source tree is not tracked by git > at all, this script does not print anything. > > Running it on the v6.1 kernel detected the following: > > $ make W=1 misc-check > Documentation/devicetree/bindings/.yamllint: warning: ignored by one of the .gitignore files > drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files > drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files > drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files > fs/ext4/.kunitconfig: warning: ignored by one of the .gitignore files > fs/fat/.kunitconfig: warning: ignored by one of the .gitignore files > kernel/kcsan/.kunitconfig: warning: ignored by one of the .gitignore files > lib/kunit/.kunitconfig: warning: ignored by one of the .gitignore files > mm/kfence/.kunitconfig: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/.gitignore: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/Makefile: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/run_tags_test.sh: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/tags_test.c: warning: ignored by one of the .gitignore files > > These are ignored by the '.*' or 'tags' in the top .gitignore, but > there is no rule to negate it. > > You might be tempted to do 'git add -f' but I want to have the real > issue fixed (by fixing a .gitignore, or by renaming files, etc.). > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> > --- > > Changes in v2: > - Add $(srctree)/ to make it work with O= > > Makefile | 6 ++++++ > scripts/misc-check | 19 +++++++++++++++++++ > 2 files changed, 25 insertions(+) > create mode 100755 scripts/misc-check > > diff --git a/Makefile b/Makefile > index 44239352d2bf..f6ff8f77a669 100644 > --- a/Makefile > +++ b/Makefile > @@ -1852,6 +1852,12 @@ rust-analyzer: > # Misc > # --------------------------------------------------------------------------- > > +PHONY += misc-check > +misc-check: > + $(Q)$(srctree)/scripts/misc-check > + > +all: misc-check > + > PHONY += scripts_gdb > scripts_gdb: prepare0 > $(Q)$(MAKE) $(build)=scripts/gdb > diff --git a/scripts/misc-check b/scripts/misc-check > new file mode 100755 > index 000000000000..bf68712d1ac1 > --- /dev/null > +++ b/scripts/misc-check > @@ -0,0 +1,19 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0-only > + > +set -e > + > +# Detect files that are tracked but ignored by git. This is checked only when > +# ${KBUILD_EXTRA_WARN} contains 1, git is installed, and the source tree is > +# tracked by git. > +check_tracked_ignored_files () { > + case "${KBUILD_EXTRA_WARN}" in > + *1*) ;; > + *) return;; > + esac > + > + git ls-files -i -c --exclude-per-directory=.gitignore 2>/dev/null | > + sed 's/$/: warning: ignored by one of the .gitignore files/' >&2 > +} > + > +check_tracked_ignored_files > -- > 2.34.1 >
On Sun 25 Dec 2022 00:51:38 GMT, Masahiro Yamada wrote: > The top .gitignore comments about how to detect files breaking > .gitignore rules, but people rarely care about it. > > Add a new W=1 warning to detect files that are tracked but ignored by > git. If git is not installed or the source tree is not tracked by git > at all, this script does not print anything. > > Running it on the v6.1 kernel detected the following: > > $ make W=1 misc-check > Documentation/devicetree/bindings/.yamllint: warning: ignored by one of the .gitignore files > drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files > drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files > drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files > fs/ext4/.kunitconfig: warning: ignored by one of the .gitignore files > fs/fat/.kunitconfig: warning: ignored by one of the .gitignore files > kernel/kcsan/.kunitconfig: warning: ignored by one of the .gitignore files > lib/kunit/.kunitconfig: warning: ignored by one of the .gitignore files > mm/kfence/.kunitconfig: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/.gitignore: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/Makefile: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/run_tags_test.sh: warning: ignored by one of the .gitignore files > tools/testing/selftests/arm64/tags/tags_test.c: warning: ignored by one of the .gitignore files > > These are ignored by the '.*' or 'tags' in the top .gitignore, but > there is no rule to negate it. > > You might be tempted to do 'git add -f' but I want to have the real > issue fixed (by fixing a .gitignore, or by renaming files, etc.). > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > Changes in v2: > - Add $(srctree)/ to make it work with O= > > Makefile | 6 ++++++ > scripts/misc-check | 19 +++++++++++++++++++ > 2 files changed, 25 insertions(+) > create mode 100755 scripts/misc-check > > diff --git a/Makefile b/Makefile > index 44239352d2bf..f6ff8f77a669 100644 > --- a/Makefile > +++ b/Makefile > @@ -1852,6 +1852,12 @@ rust-analyzer: > # Misc > # --------------------------------------------------------------------------- > > +PHONY += misc-check > +misc-check: > + $(Q)$(srctree)/scripts/misc-check > + > +all: misc-check > + > PHONY += scripts_gdb > scripts_gdb: prepare0 > $(Q)$(MAKE) $(build)=scripts/gdb > diff --git a/scripts/misc-check b/scripts/misc-check > new file mode 100755 > index 000000000000..bf68712d1ac1 > --- /dev/null > +++ b/scripts/misc-check > @@ -0,0 +1,19 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0-only > + > +set -e > + > +# Detect files that are tracked but ignored by git. This is checked only when > +# ${KBUILD_EXTRA_WARN} contains 1, git is installed, and the source tree is > +# tracked by git. > +check_tracked_ignored_files () { > + case "${KBUILD_EXTRA_WARN}" in > + *1*) ;; > + *) return;; > + esac > + > + git ls-files -i -c --exclude-per-directory=.gitignore 2>/dev/null | > + sed 's/$/: warning: ignored by one of the .gitignore files/' >&2 I like that check. It doesn't work with O=...; works for me with something like: git ${abs_srctree:+-C "${abs_srctree}"} ls-files ... Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
On Thu, Dec 29, 2022 at 1:48 AM Nicolas Schier <nicolas@fjasle.eu> wrote: > > On Sun 25 Dec 2022 00:51:38 GMT, Masahiro Yamada wrote: > > The top .gitignore comments about how to detect files breaking > > .gitignore rules, but people rarely care about it. > > > > Add a new W=1 warning to detect files that are tracked but ignored by > > git. If git is not installed or the source tree is not tracked by git > > at all, this script does not print anything. > > > > Running it on the v6.1 kernel detected the following: > > > > $ make W=1 misc-check > > Documentation/devicetree/bindings/.yamllint: warning: ignored by one of the .gitignore files > > drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files > > drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files > > drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files > > fs/ext4/.kunitconfig: warning: ignored by one of the .gitignore files > > fs/fat/.kunitconfig: warning: ignored by one of the .gitignore files > > kernel/kcsan/.kunitconfig: warning: ignored by one of the .gitignore files > > lib/kunit/.kunitconfig: warning: ignored by one of the .gitignore files > > mm/kfence/.kunitconfig: warning: ignored by one of the .gitignore files > > tools/testing/selftests/arm64/tags/.gitignore: warning: ignored by one of the .gitignore files > > tools/testing/selftests/arm64/tags/Makefile: warning: ignored by one of the .gitignore files > > tools/testing/selftests/arm64/tags/run_tags_test.sh: warning: ignored by one of the .gitignore files > > tools/testing/selftests/arm64/tags/tags_test.c: warning: ignored by one of the .gitignore files > > > > These are ignored by the '.*' or 'tags' in the top .gitignore, but > > there is no rule to negate it. > > > > You might be tempted to do 'git add -f' but I want to have the real > > issue fixed (by fixing a .gitignore, or by renaming files, etc.). > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > > --- > > > > Changes in v2: > > - Add $(srctree)/ to make it work with O= > > > > Makefile | 6 ++++++ > > scripts/misc-check | 19 +++++++++++++++++++ > > 2 files changed, 25 insertions(+) > > create mode 100755 scripts/misc-check > > > > diff --git a/Makefile b/Makefile > > index 44239352d2bf..f6ff8f77a669 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -1852,6 +1852,12 @@ rust-analyzer: > > # Misc > > # --------------------------------------------------------------------------- > > > > +PHONY += misc-check > > +misc-check: > > + $(Q)$(srctree)/scripts/misc-check > > + > > +all: misc-check > > + > > PHONY += scripts_gdb > > scripts_gdb: prepare0 > > $(Q)$(MAKE) $(build)=scripts/gdb > > diff --git a/scripts/misc-check b/scripts/misc-check > > new file mode 100755 > > index 000000000000..bf68712d1ac1 > > --- /dev/null > > +++ b/scripts/misc-check > > @@ -0,0 +1,19 @@ > > +#!/bin/sh > > +# SPDX-License-Identifier: GPL-2.0-only > > + > > +set -e > > + > > +# Detect files that are tracked but ignored by git. This is checked only when > > +# ${KBUILD_EXTRA_WARN} contains 1, git is installed, and the source tree is > > +# tracked by git. > > +check_tracked_ignored_files () { > > + case "${KBUILD_EXTRA_WARN}" in > > + *1*) ;; > > + *) return;; > > + esac > > + > > + git ls-files -i -c --exclude-per-directory=.gitignore 2>/dev/null | > > + sed 's/$/: warning: ignored by one of the .gitignore files/' >&2 > > I like that check. It doesn't work with O=...; works for me with > something like: > > git ${abs_srctree:+-C "${abs_srctree}"} ls-files ... A good catch! I will fix it in v3. Thanks. > > Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
diff --git a/Makefile b/Makefile index 44239352d2bf..f6ff8f77a669 100644 --- a/Makefile +++ b/Makefile @@ -1852,6 +1852,12 @@ rust-analyzer: # Misc # --------------------------------------------------------------------------- +PHONY += misc-check +misc-check: + $(Q)$(srctree)/scripts/misc-check + +all: misc-check + PHONY += scripts_gdb scripts_gdb: prepare0 $(Q)$(MAKE) $(build)=scripts/gdb diff --git a/scripts/misc-check b/scripts/misc-check new file mode 100755 index 000000000000..bf68712d1ac1 --- /dev/null +++ b/scripts/misc-check @@ -0,0 +1,19 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only + +set -e + +# Detect files that are tracked but ignored by git. This is checked only when +# ${KBUILD_EXTRA_WARN} contains 1, git is installed, and the source tree is +# tracked by git. +check_tracked_ignored_files () { + case "${KBUILD_EXTRA_WARN}" in + *1*) ;; + *) return;; + esac + + git ls-files -i -c --exclude-per-directory=.gitignore 2>/dev/null | + sed 's/$/: warning: ignored by one of the .gitignore files/' >&2 +} + +check_tracked_ignored_files