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] Incorrect application of .gitignore rules when using fd from a nested directory #1506

Open
1 task done
niba opened this issue Mar 5, 2024 · 3 comments
Open
1 task done

Comments

@niba
Copy link

niba commented Mar 5, 2024

Checks

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

Describe the bug you encountered:

When fd is executed from a nested directory it incorrectly ignores files that should be included based on the root .gitignore rules.

In the root directory I have a .gitignore containing this rule
/packages/*/logs

in my project I have the following files

/packages/api_next/src/models/logs/job/jobLogs.service.ts
/packages/api_next/src/models/logs/execution/executionLogs.module.ts
...
etc

When I call fd from my root it returns the files listed above. However, when I go to

/packages/api_next/

and then execute fd I receive no results.

Removing the line /packages/*/logs from gitignore resolves this issue

Describe what you expected to happen:

fd should correctly respect .gitignore and return all files in

/packages/api_next/src/models/logs/...

regardless of the cwd

What version of fd are you using?

9.0.0

Which operating system / distribution are you on?

Darwin 23.3.0 arm64
@niba niba added the bug label Mar 5, 2024
@tmccombs
Copy link
Collaborator

tmccombs commented Mar 6, 2024

This is probably a bug in the ignore crate.

I can confirm that the same issue occurs with ripgrep if I use the --files option with it.

Would you mind creating an issue for this on the ripgrep package where the code for the ignore library is?

@tmccombs
Copy link
Collaborator

tmccombs commented Mar 6, 2024

Actually, I'll just file a bug upstream.

@tmccombs
Copy link
Collaborator

tmccombs commented Mar 6, 2024

BurntSushi/ripgrep#2747

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