All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3] Create a .gitignore file in the CANONICAL_O directory
@ 2024-02-14  7:19 yegorslists--- via buildroot
  2024-02-14  8:19 ` Arnout Vandecappelle via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: yegorslists--- via buildroot @ 2024-02-14  7:19 UTC (permalink / raw)
  To: buildroot; +Cc: yann.morin.1998, thomas.petazzoni

From: Yegor Yefremov <yegorslists@googlemail.com>

This .gitignore file ignores all files in an output directory and
hence doesn't change the git status.

The .gitignore file will be only created if $(O) is a subdirectory
of $(CANONICAL_CURDIR) (aka TOPDIR, but it's only defined later).

Remove "/output" entry from the main .gitignore file as it is already
handled by this general approach.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
Changes v1 -> v2:
    - create .gitignore only if $(O) is a subfolder of $(TOPDIR) (Yann
      E. MORIN)
Changes v2 -> v3:
    - also support nested subdirectories (Yann E. MORIN)

 .gitignore | 1 -
 Makefile   | 7 +++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index bb02d9f572..14b7ca5040 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-/output
 /dl
 /.auto.deps
 /.config.cmd
diff --git a/Makefile b/Makefile
index ac625152c6..aea6abb4d3 100644
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,13 @@ endif

 CANONICAL_CURDIR = $(realpath $(CURDIR))

+# Create a default .gitignore file that ignores everything and doesn't make git
+# repository "dirty". Perform this action only if $(O) is a subdirectory of
+# $(CANONICAL_CURDIR) (aka TOPDIR, but it's only defined later).
+ifeq ($(filter-out $(CANONICAL_CURDIR)/%,$(CANONICAL_O)),)
+$(file >$(CANONICAL_O)/.gitignore,*)
+endif
+
 REQ_UMASK = 0022

 # Make sure O= is passed (with its absolute canonical path) everywhere the
--
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-14  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-14  7:19 [Buildroot] [PATCH v3] Create a .gitignore file in the CANONICAL_O directory yegorslists--- via buildroot
2024-02-14  8:19 ` Arnout Vandecappelle via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.