* [Buildroot] [PATCH v2] Create a .gitignore file in the CANONICAL_O directory
@ 2024-02-13 14:30 yegorslists--- via buildroot
2024-02-13 17:00 ` Yann E. MORIN
0 siblings, 1 reply; 2+ messages in thread
From: yegorslists--- via buildroot @ 2024-02-13 14:30 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 subfolder of
$(TOPDIR).
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)
.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..71764ce1fa 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 subfolder of
+# $(TOPDIR).
+ifeq ($(realpath $(dir $(CANONICAL_O))),$(CANONICAL_CURDIR))
+$(shell echo "*" > "$(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
* Re: [Buildroot] [PATCH v2] Create a .gitignore file in the CANONICAL_O directory
2024-02-13 14:30 [Buildroot] [PATCH v2] Create a .gitignore file in the CANONICAL_O directory yegorslists--- via buildroot
@ 2024-02-13 17:00 ` Yann E. MORIN
0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2024-02-13 17:00 UTC (permalink / raw)
To: yegorslists; +Cc: thomas.petazzoni, buildroot
Yegor, All,
On 2024-02-13 15:30 +0100, yegorslists@googlemail.com spake thusly:
> 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 subfolder of
> $(TOPDIR).
>
> 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>
> ---
[--SNIP--]
> +# Create a default .gitignore file that ignores everything and doesn't make git
> +# repository "dirty". Perform this action only if $(O) is a subfolder of
s/subfolder/subdirectory/
> +# $(TOPDIR).
> +ifeq ($(realpath $(dir $(CANONICAL_O))),$(CANONICAL_CURDIR))
This only accounts for direct sub-directory, i.e. $(TOPDIR)/foo, not
$(TOPDIR)/project-42/board-27/debug which is arguably more interesting.
What about:
diff --git a/Makefile b/Makefile
index ac625152c6..ba76949e6d 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
This is quite simple, and accounts for arbitrarily-deep sub-directories.
Note: since we work with the CANONICAL_* variants, we know they do not
end with a '/' so even if the user calls O=/path/to/buildroot/ , we'd
find that it is _not_ a subdirectory, and thuis we wil lnot overwrite
our own .gitignore file.
Regards,
Yann E. MORIN.
> +$(shell echo "*" > "$(CANONICAL_O)/.gitignore")
> +endif
> +
> REQ_UMASK = 0022
>
> # Make sure O= is passed (with its absolute canonical path) everywhere the
> --
> 2.34.1
>
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-13 17:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13 14:30 [Buildroot] [PATCH v2] Create a .gitignore file in the CANONICAL_O directory yegorslists--- via buildroot
2024-02-13 17:00 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox