Fd: gitignore not honored

Created on 8 Mar 2019  路  2Comments  路  Source: sharkdp/fd

fd seems to no longer honor gitignore files by default? To test this, I setup a basic file structure for testing:

$ tree -a .
.
|-- .gitignore
|-- a/
|   `-- file1.txt
|-- b/
|   `-- file2.txt
`-- c/
    `-- file3.txt

3 directories, 4 files

The .gitignore just contains:

a/

Then when I run fd I get this:

$ fd
a
a/file1.txt
b
b/file2.txt
c
c/file3.txt

But if I explicitly add the .gitignore as an ignore-file it works:

$ fd --ignore-file .gitignore
b
b/file2.txt
c
c/file3.txt

Also, renaming it to .ignore works:

$ mv .gitignore .ignore
$ fd
b
b/file2.txt
c
c/file3.txt

The README still talks about .gitignore being honored by default and the options on the app seem to indicate that it will be used unless disabled. However, that doesn't seem to be the case.

$ fd --version
fd 7.3.0
question

Most helpful comment

Thank you for the feedback!

As of recently, .gitignore files are only honored if the folder is actually a Git repository. Hope that resolves your question.

All 2 comments

Thank you for the feedback!

As of recently, .gitignore files are only honored if the folder is actually a Git repository. Hope that resolves your question.

Thank you for clarifying. I was going to complain that this isn't clarified in the docs, but I just looked again and saw this:

If we work in a directory that is a Git repository (or includes Git repositories), fd does not search folders (and does not show files) that match one of the .gitignore patterns.

So apparently I just can't read. Appreciate you pointing me in the right direction. Will close now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mathomp4 picture mathomp4  路  4Comments

longcp picture longcp  路  3Comments

christianbundy picture christianbundy  路  3Comments

Dietr1ch picture Dietr1ch  路  3Comments

sharkdp picture sharkdp  路  4Comments