Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression in incremental Watchman queries on Windows #1231

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/metro-file-map/src/crawlers/watchman/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {performance} from 'perf_hooks';
const watchman = require('fb-watchman');

type WatchmanRoots = Map<
string,
string, // Posix-separated absolute path
$ReadOnly<{directoryFilters: Array<string>, watcher: string}>,
>;

Expand Down Expand Up @@ -181,7 +181,7 @@ module.exports = async function watchmanCrawl({

await Promise.all(
Array.from(rootProjectDirMappings).map(
async ([root, {directoryFilters, watcher}], index) => {
async ([posixSeparatedRoot, {directoryFilters, watcher}], index) => {
// Jest is only going to store one type of clock; a string that
// represents a local clock. However, the Watchman crawler supports
// a second type of clock that can be written by automation outside of
Expand All @@ -191,7 +191,11 @@ module.exports = async function watchmanCrawl({
// By using scm queries, we can create the haste map on a different
// system and import it, transforming the clock into a local clock.
const since = previousState.clocks.get(
normalizePathSeparatorsToPosix(pathUtils.absoluteToNormal(root)),
normalizePathSeparatorsToPosix(
pathUtils.absoluteToNormal(
normalizePathSeparatorsToSystem(posixSeparatedRoot),
),
),
);

perfLogger?.annotate({
Expand All @@ -218,7 +222,7 @@ module.exports = async function watchmanCrawl({
perfLogger?.point(`watchmanCrawl/query_${index}_start`);
const response = await cmd<WatchmanQueryResponse>(
'query',
root,
posixSeparatedRoot,
query,
);
perfLogger?.point(`watchmanCrawl/query_${index}_end`);
Expand All @@ -232,7 +236,7 @@ module.exports = async function watchmanCrawl({
isFresh = isFresh || response.is_fresh_instance;
}

results.set(root, response);
results.set(posixSeparatedRoot, response);
},
),
);
Expand Down