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

Include .git/ folder in the "gitignored" filtering #1387

Closed
marcospb19 opened this issue Sep 24, 2023 · 6 comments · Fixed by #1396
Closed

Include .git/ folder in the "gitignored" filtering #1387

marcospb19 opened this issue Sep 24, 2023 · 6 comments · Fixed by #1396

Comments

@marcospb19
Copy link
Contributor

I mostly use fd in repositories, and I love having the ability of gitignoring pollution from build folders.

However, I keep getting tons of stuff from .git/.

I consider .git/ to be "gitignored by default", but that might just be my POV, any thoughts on this?

I imagine the odds of someone intentionally looking for stuff in the .git/ directory should be low, but in that case, they can resort to -I/--no-ignore (or --no-ignore-vcs).

@skoriop
Copy link
Contributor

skoriop commented Oct 4, 2023

Hi, I'd like to work on this if it's still up :)

@marcospb19
Copy link
Contributor Author

marcospb19 commented Oct 4, 2023

Awesome! Take your shot :) .

fd uses WalkBuilder from the library ignore, take a look at

fd/src/walk.rs

Line 75 in 93cdb26

.hidden(config.ignore_hidden)
and https://docs.rs/ignore/latest/ignore/struct.WalkBuilder.html.

You might want to check if WalkBuilder supports doing this, maybe there's an issue to support this in the ignore crate repo?

@marcospb19
Copy link
Contributor Author

marcospb19 commented Oct 4, 2023

Oh, be aware that this wasn't officially approved by maintainers, so there is some chance they'll close your PR, in case they are opposed to this change, I imagine they're not, but it's good to gather confirmation before.

(btw, I'm not a maintainer xD just an user.)

If you want to be 100% safe that you won't waste your time, you should probably wait for official approval.

@tmccombs made a favorable comment at #1317 (comment), I don't know if that counts.

@tmccombs
Copy link
Collaborator

tmccombs commented Oct 4, 2023

I am in favor of this change.

@raphael-ratepay
Copy link

Why is there no option to opt out of this?
I had the following to list all my Projects:

fd --type d --base-directory ~/Source -H '\.git' | sed 's|/.git||'

now if I add --no-ignore-vcs i get all folders inside my ignores (not just the .git folder)

@glucas
Copy link

glucas commented Jan 4, 2024

Why is there no option to opt out of this? I had the following to list all my Projects:

fd --type d --base-directory ~/Source -H '\.git' | sed 's|/.git||'

If you use '.git$', does that help? I have something similar in a "git all" alias. Depending on how your repos are organized you might also use --max-depth to avoid unnecessary scanning of sub-directories. (I use --max-depth=2).

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

Successfully merging a pull request may close this issue.

5 participants