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] ~/.ignore & ~/.fdignore are not respected #901

Closed
ahmedelgabri opened this issue Dec 2, 2021 · 6 comments · Fixed by #908
Closed

[BUG] ~/.ignore & ~/.fdignore are not respected #901

ahmedelgabri opened this issue Dec 2, 2021 · 6 comments · Fixed by #908

Comments

@ahmedelgabri
Copy link

(Bug template gave me 400 a couple of times, that's why I didn't use it)

~/.ignore & ~/.fdignore are not respected

echo .git > ~/.ignore # or ~/.fdignore
cd ~/repo
fd --hidden --no-ignore-vcs # will show .git in the results

while works with ~/.config/fd/ignore

mkdir -p ~/.config/fd
echo .git > ~/.config/fd/ignore
cd ~/repo
fd --hidden --no-ignore-vcs # will NOT show .git in the results

fd 8.3.0 on macOS Monterey 12.0.1

ahmedelgabri added a commit to ahmedelgabri/dotfiles that referenced this issue Dec 3, 2021
@tavianator
Copy link
Collaborator

Is ~/.ignore or ~/.fdignore documented? As far as I can tell, only ~/.config/fd/ignore is documented to apply globally.

@ahmedelgabri
Copy link
Author

@tavianator

From this comment #485 by @sharkdp

A .fdignore or .ignore file will always just affect directories below it (just like .gitignore files).

So, technically if I have ~/.ignore or ~/.fdignore it should work, and it was working like that.

I'm fine if the behaviour changed now, but at least document that or explicitly mention how it works now. Because I was surprised when I started to see .git & node_modules popping up in my search.

@tavianator
Copy link
Collaborator

Ohh right I see. ~/.ignore/~/.fdignore are not global ignore files but they ought to apply to your whole home directory, including ~/repo. And indeed they do in my testing, but --no-ignore-vcs breaks it.

This was broken by f8ae334, aka #817. This snippet turns off read_parent_ignore a little too aggressively.

@phongnh
Copy link

phongnh commented Dec 20, 2021

Same problem on my side for fd 8.3. I use fd for vim fuzzy finder plugins. In my case I don't use .gitignore in project because it ignores config files that I needed like config/database.yml in Rails project. Instead, I use .ignore (.fdignore) at parent dir to ignore custom files that I never open. For example:

$ tree -L 1 ~/projects/
.
├── rails-app1
└── rails-app2
# ~/projects/.ignore
vendor/
*.scss
*.js

Maybe the flag --no-ignore-parent should not go along with --no-ignore-vcs?

I tried to build fd from source with this check removed, it works for my case.

image

tmccombs added a commit to tmccombs/fd that referenced this issue Dec 21, 2021
Make sure that using `--no-ignore-vcs` or `--no-ignore` don't also
enable `--no-ignore-parent`. So that if `--no-ignore-vcs` is enabled, it
continues to respect .fdignore and .ignore in the parent directories.

Fixes: sharkdp#907
Fixes: sharkdp#901
tmccombs added a commit to tmccombs/fd that referenced this issue Dec 23, 2021
Make sure that using `--no-ignore-vcs` or `--no-ignore` don't also
enable `--no-ignore-parent`. So that if `--no-ignore-vcs` is enabled, it
continues to respect .fdignore and .ignore in the parent directories.

Fixes: sharkdp#907
Fixes: sharkdp#901
tmccombs added a commit that referenced this issue Dec 23, 2021
Make sure that using `--no-ignore-vcs` or `--no-ignore` don't also
enable `--no-ignore-parent`. So that if `--no-ignore-vcs` is enabled, it
continues to respect .fdignore and .ignore in the parent directories.

Fixes: #907
Fixes: #901
@sharkdp
Copy link
Owner

sharkdp commented Jan 6, 2022

Fixed in https://github.com/sharkdp/fd/releases/tag/v8.3.1

@towry
Copy link

towry commented Nov 23, 2023

NOTE:

If the current directory includes a .ignore file, the ~/.ignore file will not have any impact.

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

Successfully merging a pull request may close this issue.

5 participants