Skip to content

Commit

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

**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 afterward. 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 authored Feb 19, 2018
1 parent 3a2854a commit adbd927
Show file tree
Hide file tree
Showing 2 changed files with 318 additions and 261 deletions.
Loading

0 comments on commit adbd927

Please sign in to comment.