Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: yegorslists@googlemail.com
Cc: thomas.petazzoni@bootlin.com, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2] Create a .gitignore file in the CANONICAL_O directory
Date: Tue, 13 Feb 2024 18:00:40 +0100	[thread overview]
Message-ID: <ZcugOP8E783em4Cz@landeda> (raw)
In-Reply-To: <20240213143025.274988-1-yegorslists@googlemail.com>

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

      reply	other threads:[~2024-02-13 17:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZcugOP8E783em4Cz@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yegorslists@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox