Skip to content

Fix include logic where include path is subdirectory of excluded path.#302

Merged
swissspidy merged 2 commits intowp-cli:mainfrom
shendy-a8c:fix/include-subfolder-of-excluded
Jan 19, 2022
Merged

Fix include logic where include path is subdirectory of excluded path.#302
swissspidy merged 2 commits intowp-cli:mainfrom
shendy-a8c:fix/include-subfolder-of-excluded

Conversation

@shendy-a8c
Copy link
Contributor

@shendy-a8c shendy-a8c commented Jan 17, 2022

Fixes #172.

Changes in this PR:

  • Fix containsMatchingChildren(), so $root_relative_path doesn't have trailing slash. [#]. This is because $include and $exclude are trailing-slash-trimmed, so if $root_relative_path isn't, this clause won't be true as expected.
  • When the file iterator gets to the included folder, which is a subfolder of an excluded folder, it will get here, so I created a new if block to handle that case.
  • Unit test for this case: including a folder inside an excluded folder.

@shendy-a8c shendy-a8c requested a review from a team as a code owner January 17, 2022 11:05
@shendy-a8c shendy-a8c mentioned this pull request Jan 17, 2022
2 tasks
@swissspidy
Copy link
Member

Thanks a lot for this PR!

No yoda condition.

Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
@shendy-a8c
Copy link
Contributor Author

@swissspidy I'm not rushing but just want to make sure if there is any action item on my side.

@swissspidy swissspidy merged commit fdc6e15 into wp-cli:main Jan 19, 2022
@schlessera schlessera added this to the 2.2.14 milestone Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vendor folder ignored

3 participants