]> source.dussan.org Git - jgit.git/commit
Skip ignored directories in FileTreeIterator 37/120337/3
authorThomas Wolf <thomas.wolf@paranor.ch>
Tue, 27 Mar 2018 20:22:09 +0000 (22:22 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 22 May 2018 01:03:35 +0000 (03:03 +0200)
commitd7deda98d0a18ca1e3a1fbb70acf8e7cbcf25833
treef9d7fc4ad0ac7ce7d0dc0dc5eb931239b8b1f59f
parent1da2ff7242dfc6df4d470e8519bfd8267940791a
Skip ignored directories in FileTreeIterator

Make FileTreeIterator not enter ignored directories by default. We
only need to enter ignored directories if we do some operation against
git, and there is at least one tracked file underneath an ignored
directory.

Walking ignored directories should be avoided as much as possible as
it is a potential performance bottleneck. Some projects have a lot of
files or very deep hierarchies in ignored directories; walking those
may be costly (especially so on Windows). See for instance also bug
500106.

Provide a FileTreeIterator.setWalkIgnoredDirectories() operation to
force the iterator to iterate also through otherwise ignored
directories. Useful for tests (IgnoreNodeTest, CGitIgnoreTest), or
to implement things like "git ls-files --ignored".

Add tests in DirCacheCheckoutTest, and amend IndexDiffTest to test a
little bit more.

Bug: 388582
Change-Id: I6ff584a42c55a07120a4369fd308409431bdb94a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/CGitIgnoreTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java