project.fileTree() is not finding .gitignore nor .gitattribute files


(Krystian Panek) #1

Hey! I am writing Gradle plugin and I have a question about project.fileTree() method.
When I write project.fileTree(“my/dir”) and I have files named “.gitignore” or “.gitattributes” inside it then they are not in collection project.fileTree(“my/dir”).files ( I am sure that I am not using any filters / patternfilterables and I don’t that there are some defaults on debugger).

When I write project.file(“my/dir/.gitignore”).exists() it returns true.

Any ideas how to force that Gradle fileTree will find these files? What is interesting for me, file like “.editorconfig” is being found and has dot in the beginning, but Git files are not being found.

Probably the reason is that even Windows is treating this files in a different way (for .editorconfig, the file name is being displayed in explorer, for Git files, there are no names displayed).


Any ideas?!
Gradle 4.3.1 / Windows 10

(Krystian Panek) #2

OK, going deeper I found:
so now the question is how to disable it from Gradle API?

(Krystian Panek) #3

There is no clean solution to fix this, for a reference, see: