eza-community / eza

A modern alternative to ls
https://eza.rocks
European Union Public License 1.2
11.98k stars 217 forks source link

bug: `--git-ignore` ignores `.gitignore` file in child directory #1086

Open injust opened 2 months ago

injust commented 2 months ago

When running eza --tree --git-ignore, eza will respect a .gitignore file if it's in the current directory or a parent directory. When recursing (e.g. with --tree), eza ignores .gitignore files in child directories.

For example: I have a Git repo at ~/code/repo/ with a .gitignore file at ~/code/repo/.gitignore.

If I run eza --tree --git-ignore from ~/code/repo/, it works as expected. If I run eza --tree --git-ignore from ~/code/, the .gitignore is ignored.


eza version: 0.19.0 [+git] Shell: fish v3.7.1 Terminal: Ghostty OS: macOS Sonoma 14.6 (Intel)

cafkafk commented 2 months ago

I can't reproduce this:

eza -T
.
├── bla
└── blo
   └── file
eza -T --git-ignore 
.
├── bla
└── blo
bat -p blo/.gitignore 
file
cafkafk commented 2 months ago

Ideally, if you could post an example repo that would likely make it much quicker to reproduce

injust commented 2 months ago

image

injust commented 2 months ago

Ah, I think I explained it badly. The gitignore file is still at the root of the repo, but the repo is a child directory of where I am running the eza command.

I can't reproduce this:

eza -T
.
├── bla
└── blo
   └── file
eza -T --git-ignore 
.
├── bla
└── blo
bat -p blo/.gitignore 
file

I think it would have repro'd if you cd .. and ran the same eza command.