summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Nipunn Koorapati <nipunn@dropbox.com>2020-10-26 19:32:45 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-10-26 16:39:33 -0700
commit0288b9322d37b2b1644fd11afb9929ce75f32af5 (patch)
treef2837dea9f7da43bc161354762eccc832ee8fac7
parentt/perf/fsmonitor: separate one time repo initialization (diff)
downloadtgif-0288b9322d37b2b1644fd11afb9929ce75f32af5.tar.xz
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>
-rwxr-xr-xt/perf/p7519-fsmonitor.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index 23755012df..4030f569cf 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -94,7 +94,13 @@ test_expect_success "one time repo setup" '
for i in $(test_seq 1 1000); do touch 1000_files/$i; done &&
for i in $(test_seq 1 10000); do touch 10000_files/$i; done &&
git add 1_file 10_files 100_files 1000_files 10000_files &&
- git commit -m "Add files"
+ git commit -m "Add files" &&
+
+ # If Watchman exists, watch the work tree and attempt a query.
+ if test_have_prereq WATCHMAN; then
+ watchman watch "$GIT_WORK_TREE" &&
+ watchman watch-list | grep -q -F "$GIT_WORK_TREE"
+ fi
'
test_expect_success "setup for fsmonitor" '
@@ -105,17 +111,13 @@ test_expect_success "setup for fsmonitor" '
else
#
# Choose integration script based on existence of Watchman.
- # If Watchman exists, watch the work tree and attempt a query.
- # If everything succeeds, use Watchman integration script,
- # else fall back to an empty integration script.
+ # Fall back to an empty integration script.
#
mkdir .git/hooks &&
if test_have_prereq WATCHMAN
then
INTEGRATION_SCRIPT=".git/hooks/fsmonitor-watchman" &&
- cp "$TEST_DIRECTORY/../templates/hooks--fsmonitor-watchman.sample" "$INTEGRATION_SCRIPT" &&
- watchman watch "$GIT_WORK_TREE" &&
- watchman watch-list | grep -q -F "$GIT_WORK_TREE"
+ cp "$TEST_DIRECTORY/../templates/hooks--fsmonitor-watchman.sample" "$INTEGRATION_SCRIPT"
else
INTEGRATION_SCRIPT=".git/hooks/fsmonitor-empty" &&
write_script "$INTEGRATION_SCRIPT"<<-\EOF