fd icon indicating copy to clipboard operation
fd copied to clipboard

[BUG] fd showing hidden folder contents ignored by parent .gitignore.

Open smartinellimarco opened this issue 1 year ago • 3 comments

Checks

  • [X] I have read the troubleshooting section and still think this is a bug.

Describe the bug you encountered:

Given this directory:

.
├── .git
├── .gitignore
└── myfolder <-- Current directory
    ├── .pulumi
    ├── __pycache__
    ├── data
    └── venv

and the following .gitignore:

**/.pulumi/backups/
**/.pulumi/history/

When calling 'fd --hidden' from inside 'myfolder', I get all the files in the ignored folders listed.

It behaves correctly if the cwd is:

. <-- Current directory
├── .git
├── .gitignore
└── myfolder
    ├── .pulumi
    ├── __pycache__
    ├── data
    └── venv

Describe what you expected to happen:

'fd' respecting the parent .gitignore

What version of fd are you using?

fd 10.1.0

Which operating system / distribution are you on?

Darwin 23.3.0 arm64

smartinellimarco avatar Jul 15 '24 23:07 smartinellimarco

This behavior is also exhibited by rigprep (with rg --files --hidden), so this is probably a bug in the upstream ignore project. You should probably file it on the ripgrep project.

From some experimentation, I've found that this seems to only happen when you have a pattern with path components.

Here is a minimal reproduction:

$ cat .ignore
**/test/dir/
$ tree
.
└── myfolder
    ├── dat
    └── test
        └── dir
            └── a

4 directories, 2 files
$ fd
myfolder/
myfolder/dat
myfolder/test/
$ cd myfolder
$ fd
dat
test/
test/dir/
test/dir/a
$ rg --files
dat
test/dir/a

tmccombs avatar Aug 08 '24 05:08 tmccombs

I think this might be the same as https://github.com/BurntSushi/ripgrep/issues/2836

tmccombs avatar Aug 08 '24 05:08 tmccombs

This seems to still be an issue - I started running into it after a poorly thought out series of library upgrades on my machine.

While we wait for a fix (whether in fd or in the ignore project), has anyone worked out a solid fix that can be done from configuration by the user?

istateside avatar Jan 10 '25 15:01 istateside

This should be fixed by #1813

tmccombs avatar Oct 31 '25 06:10 tmccombs