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 <nipunn@dropbox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nipunn Koorapati committed Oct 26, 2020 at 19:32 UTC 0288b9322d37b2b1644fd11afb9929ce75f32af5
1 file changed +9 -7
t/perf/p7519-fsmonitor.sh
+9 -7
@@ -94,7 +94,13 @@ test_expect_success "one time repo setup" '
94 for i in $(test_seq 1 1000); do touch 1000_files/$i; done &&
95 for i in $(test_seq 1 10000); do touch 10000_files/$i; done &&
96 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
104 '
105
106 test_expect_success "setup for fsmonitor" '
@@ -105,17 +111,13 @@ test_expect_success "setup for fsmonitor" '
111 else
112 #
113 # 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.
115 #
116 mkdir .git/hooks &&
117 if test_have_prereq WATCHMAN
118 then
119 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"
121 else
122 INTEGRATION_SCRIPT=".git/hooks/fsmonitor-empty" &&
123 write_script "$INTEGRATION_SCRIPT"<<-\EOF