Skip to content

Commit 0288b93

Browse files
nipunn1313gitster
authored andcommitted
t/perf/fsmonitor: move watchman setup to one-time-repo-setup
It is only required to be set up once. This prepares for testing multiple hooks in one invocation. Signed-off-by: Nipunn Koorapati <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bb7cc7e commit 0288b93

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

t/perf/p7519-fsmonitor.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ test_expect_success "one time repo setup" '
9494
for i in $(test_seq 1 1000); do touch 1000_files/$i; done &&
9595
for i in $(test_seq 1 10000); do touch 10000_files/$i; done &&
9696
git add 1_file 10_files 100_files 1000_files 10000_files &&
97-
git commit -m "Add files"
97+
git commit -m "Add files" &&
98+
99+
# If Watchman exists, watch the work tree and attempt a query.
100+
if test_have_prereq WATCHMAN; then
101+
watchman watch "$GIT_WORK_TREE" &&
102+
watchman watch-list | grep -q -F "$GIT_WORK_TREE"
103+
fi
98104
'
99105

100106
test_expect_success "setup for fsmonitor" '
@@ -105,17 +111,13 @@ test_expect_success "setup for fsmonitor" '
105111
else
106112
#
107113
# Choose integration script based on existence of Watchman.
108-
# If Watchman exists, watch the work tree and attempt a query.
109-
# If everything succeeds, use Watchman integration script,
110-
# else fall back to an empty integration script.
114+
# Fall back to an empty integration script.
111115
#
112116
mkdir .git/hooks &&
113117
if test_have_prereq WATCHMAN
114118
then
115119
INTEGRATION_SCRIPT=".git/hooks/fsmonitor-watchman" &&
116-
cp "$TEST_DIRECTORY/../templates/hooks--fsmonitor-watchman.sample" "$INTEGRATION_SCRIPT" &&
117-
watchman watch "$GIT_WORK_TREE" &&
118-
watchman watch-list | grep -q -F "$GIT_WORK_TREE"
120+
cp "$TEST_DIRECTORY/../templates/hooks--fsmonitor-watchman.sample" "$INTEGRATION_SCRIPT"
119121
else
120122
INTEGRATION_SCRIPT=".git/hooks/fsmonitor-empty" &&
121123
write_script "$INTEGRATION_SCRIPT"<<-\EOF

0 commit comments

Comments
 (0)