Skip to content

Commit e262bc1

Browse files
committed
Merge branch 'kw/fsmonitor-watchman-fix' into jch
* kw/fsmonitor-watchman-fix: fsmonitor: fix watchman integration
2 parents 9bdd8c5 + dd0b61f commit e262bc1

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

t/t7519/fsmonitor-watchman

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ my ($version, $time) = @ARGV;
2323

2424
if ($version == 1) {
2525
# convert nanoseconds to seconds
26-
$time = int $time / 1000000000;
26+
# subtract one second to make sure watchman will return all changes
27+
$time = int ($time / 1000000000) - 1;
2728
} else {
2829
die "Unsupported query-fsmonitor hook version '$version'.\n" .
2930
"Falling back to scanning...\n";
@@ -54,18 +55,12 @@ sub launch_watchman {
5455
#
5556
# To accomplish this, we're using the "since" generator to use the
5657
# recency index to select candidate nodes and "fields" to limit the
57-
# output to file names only. Then we're using the "expression" term to
58-
# further constrain the results.
59-
#
60-
# The category of transient files that we want to ignore will have a
61-
# creation clock (cclock) newer than $time_t value and will also not
62-
# currently exist.
58+
# output to file names only.
6359

6460
my $query = <<" END";
6561
["query", "$git_work_tree", {
6662
"since": $time,
67-
"fields": ["name"],
68-
"expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]]
63+
"fields": ["name"]
6964
}]
7065
END
7166

templates/hooks--fsmonitor-watchman.sample

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ my ($version, $time) = @ARGV;
2222

2323
if ($version == 1) {
2424
# convert nanoseconds to seconds
25-
$time = int $time / 1000000000;
25+
# subtract one second to make sure watchman will return all changes
26+
$time = int ($time / 1000000000) - 1;
2627
} else {
2728
die "Unsupported query-fsmonitor hook version '$version'.\n" .
2829
"Falling back to scanning...\n";
@@ -53,18 +54,12 @@ sub launch_watchman {
5354
#
5455
# To accomplish this, we're using the "since" generator to use the
5556
# recency index to select candidate nodes and "fields" to limit the
56-
# output to file names only. Then we're using the "expression" term to
57-
# further constrain the results.
58-
#
59-
# The category of transient files that we want to ignore will have a
60-
# creation clock (cclock) newer than $time_t value and will also not
61-
# currently exist.
57+
# output to file names only.
6258

6359
my $query = <<" END";
6460
["query", "$git_work_tree", {
6561
"since": $time,
66-
"fields": ["name"],
67-
"expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]]
62+
"fields": ["name"]
6863
}]
6964
END
7065

0 commit comments

Comments
 (0)