8000 [Finder] Fix finding VCS re-included files in excluded directory · symfony/symfony@f3cb377 · GitHub
[go: up one dir, main page]

Skip to content

Commit f3cb377

Browse files
committed
[Finder] Fix finding VCS re-included files in excluded directory
1 parent 6a52b66 commit f3cb377

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Symfony/Component/Finder/Iterator/VcsIgnoredFilterIterator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ private function isIgnored(string $fileRealPath): bool
6060

6161
foreach ($this->parentsDirectoryDownward($fileRealPath) as $parentDirectory) {
6262
if ($this->isIgnored($parentDirectory)) {
63-
$ignored = true;
64-
6563
// rules in ignored directories are ignored, no need to check further.
6664
break;
6765
}

src/Symfony/Component/Finder/Tests/Iterator/VcsIgnoredFilterIteratorTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,20 @@ public function getAcceptData(): iterable
247247
'a/b/c/d.txt',
248248
],
249249
];
250+
251+
yield 'file included from subdirectory with everything excluded' => [
252+
[
253+
'.gitignore' => "/a/**\n!/a/b.txt",
254+
],
255+
[
256+
'a/a.txt',
257+
'a/b.txt',
258+
'a/c.txt',
259+
],
260+
[
261+
'a/b.txt',
262+
],
263+
];
250264
}
251265

252266
public function testAcceptAtRootDirectory()

0 commit comments

Comments
 (0)
0