Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
smartinellimarco opened this issue Jul 15, 2024 · 2 comments
Open
1 task done

Comments

@smartinellimarco
Copy link

smartinellimarco commented Jul 15, 2024

Checks

  • 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
@tmccombs
Copy link
Collaborator

tmccombs commented Aug 8, 2024

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
Copy link
Collaborator

tmccombs commented Aug 8, 2024

I think this might be the same as BurntSushi/ripgrep#2836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants