-
-
Notifications
You must be signed in to change notification settings - Fork 816
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] Including hidden files also includes (git)ignored files if the .gitignore is in the parent directory #1461
Comments
This definitely seems like a bug in the tavianator@graphene $ tree -a .
.
├── .abc
├── .git
├── .gitignore
└── sub_directory
└── .abc
2 directories, 4 files
tavianator@graphene $ cat .gitignore
.abc
tavianator@graphene $ cd sub_directory
tavianator@graphene $ fd --hidden
.abc
tavianator@graphene $ fd --hidden --search-path ./
tavianator@graphene $ rg --hidden --files .
./.abc
tavianator@graphene $ rg --hidden --files ./
tavianator@graphene $ Since |
This seems somewhat similar to BurntSushi/ripgrep#829. |
Sorry for not responding earlier; I wanted to dig a little bit into it and hadn't had the time to do that before. The problems might be similar, but I don't think they are directly related. I think I tracked down the problem for the hidden files in the ignore crate, and made a PR there (BurntlSushi/ripgrep#2711). In the meantime, until it gets fixed in ripgrep, one could apply the fix I proposed above? |
That seems reasonable as long as it doesn't break anything else |
This is a workaround for BurntSushi/ripgrep#2711 Fixes: sharkdp#1461
This is a workaround for BurntSushi/ripgrep#2711 Fixes: sharkdp#1461
This is a workaround for BurntSushi/ripgrep#2711 Fixes: #1461
Checks
Describe the bug you encountered:
Assume we have the following directory structure:
where
Using
fd
in thesup_directory
with--hidden
, I getThe
.abc
file is shown, although it should have been ignored.Describe what you expected to happen:
Do not show the
.abc
file.Note that this only happens in the
sup_directory
. Usingfd --hidden
in the root directory shows the expected output.Possible Fix:
All tests pass in the github workflows with this change.
The bug is not really caused by something
fd
is doing but rather by what the "Walker" in theignore
dependency is doing. A simple loop overWalkBuilder::new(path).hidden(false).build()
withpath = "."
andpath = "./"
leads to the same wrong and correct results, respectively. Maybe one could report it as a bug there? I'm rather confused by this behavior though.Anyways, the diff above should fix it in
fd
, I think (could open a PR if you want).What version of
fd
are you using?fd 9.0.0
Which operating system / distribution are you on?
The text was updated successfully, but these errors were encountered: