Skip to contentSkip to conversation

Create a .gitignore file in the CANONICAL_O directory

PATCH Superseded yegorslists--- via buildroot 1 participant 2 messages Feb 14, 2024 Kbuild

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Create a .gitignore file in the CANONICAL_O directory

From: Yegor Yefremov <[email protected]>

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.

---
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(-)
.gitignore +0 -1
index bb02d9f572..14b7ca5040 100644
@@ -1,4 +1,3 @@
-/output
 /dl
 /.auto.deps
 /.config.cmd
Makefile +7 -0
index ac625152c6..aea6abb4d3 100644
@@ -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
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw
Quoted 8 lines · On 14/02/2024 08:19, [email protected] wrote:

From: Yegor Yefremov <[email protected]>

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).

Quoted 8 lines

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

---
Changes v1 -> v2:
- create .gitignore only if $(O) is a subfolder of $(TOPDIR) (Yann E. MORIN)

I like to create my output directories as subfolders of my BR2_EXTERNAL.
Currently I have them in the .gitignore of the BR2_EXTERNAL itself, of course, but it would be convenient if they got ignored automatically.

In other words, I'd like to go back to v1 of this patch. There's no reason,
ever, to not want an output directory to be gitignored.

Since two maintainers are disagreeing about this, I guess it's up to the other
maintainers to pipe up and take a decision?

Regards,
Arnout

Quoted 35 lines

Changes v2 -> v3:
- also support nested subdirectories (Yann E. MORIN)

  .gitignore | 1 -
  Makefile   | 7 +++++++
  2 files changed, 7 insertions(+), 1 deletion(-)
.gitignore +0 -1
index bb02d9f572..14b7ca5040 100644
@@ -1,4 +1,3 @@
-/output
  /dl
  /.auto.deps
  /.config.cmd
Makefile +7 -1
index ac625152c6..aea6abb4d3 100644
@@ -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
--
Quoted 2 lines

2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot