Skip to content

Commit

Permalink
fix(watchman): Overhauls how Watchman crawler works fixing Windows is…
Browse files Browse the repository at this point in the history
…sues

**Summary**

Watchman crawler was ignoring the `relative_path` field in the response of
a `watch-project` call, requiring it to match watch roots with the actual
project roots afterwards. Not only this was inefficient, it was also faulty
due to the naive `.startsWith()` check in `isDescendant()`. This was causing
issues both with Windows file paths (#5553) and after that with case-insensitive
file systems where the names from Watchman did not match the casing of the passed
roots.

This patch replaces all that logic by taking the `relative_path` field into account
and does some consolidation along with using `async`/`await` instead of promises.

**Test plan**

Run the updated test suite on all platforms and make sure it passes. I've also
verified this on some internal Windows repos by manually patching the built module
and making sure there are no warnings regarding duplicated haste names due to incorrect
crawling of project root siblings.
  • Loading branch information
BYK committed Feb 19, 2018
1 parent 0b88438 commit 6894a32
Show file tree
Hide file tree
Showing 2 changed files with 326 additions and 263 deletions.
Loading

0 comments on commit 6894a32

Please sign in to comment.