aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-10-04 14:21:43 -0700
committerJunio C Hamano <gitster@pobox.com>2024-10-04 14:21:43 -0700
commit2ab53b59efcd6688ae176db054a938b835258abf (patch)
tree576e39adf93d3ea6edb082732011559cf672b6ac /t
parentbffc417e7c0c273371ec94f08c03405b288de38a (diff)
parent435a6900d27767014b10da79249a50f4bd6a0944 (diff)
downloadgit-2ab53b59efcd6688ae176db054a938b835258abf.tar.xz
Merge branch 'kn/osx-fsmonitor-with-submodules-fix'
macOS with fsmonitor daemon can hang forever when a submodule is involved, which has been corrected. * kn/osx-fsmonitor-with-submodules-fix: fsmonitor OSX: fix hangs for submodules
Diffstat (limited to 't')
-rwxr-xr-xt/t7527-builtin-fsmonitor.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/t/t7527-builtin-fsmonitor.sh b/t/t7527-builtin-fsmonitor.sh
index 730f3c7f81..9b15baa02d 100755
--- a/t/t7527-builtin-fsmonitor.sh
+++ b/t/t7527-builtin-fsmonitor.sh
@@ -907,6 +907,57 @@ test_expect_success "submodule absorbgitdirs implicitly starts daemon" '
test_subcommand git fsmonitor--daemon start <super-sub.trace
'
+start_git_in_background () {
+ git "$@" &
+ git_pid=$!
+ git_pgid=$(ps -o pgid= -p $git_pid)
+ nr_tries_left=10
+ while true
+ do
+ if test $nr_tries_left -eq 0
+ then
+ kill -- -$git_pgid
+ exit 1
+ fi
+ sleep 1
+ nr_tries_left=$(($nr_tries_left - 1))
+ done >/dev/null 2>&1 &
+ watchdog_pid=$!
+ wait $git_pid
+}
+
+stop_git () {
+ while kill -0 -- -$git_pgid
+ do
+ kill -- -$git_pgid
+ sleep 1
+ done
+}
+
+stop_watchdog () {
+ while kill -0 $watchdog_pid
+ do
+ kill $watchdog_pid
+ sleep 1
+ done
+}
+
+test_expect_success !MINGW "submodule implicitly starts daemon by pull" '
+ test_atexit "stop_watchdog" &&
+ test_when_finished "stop_git; rm -rf cloned super sub" &&
+
+ create_super super &&
+ create_sub sub &&
+
+ git -C super submodule add ../sub ./dir_1/dir_2/sub &&
+ git -C super commit -m "add sub" &&
+ git clone --recurse-submodules super cloned &&
+
+ git -C cloned/dir_1/dir_2/sub config core.fsmonitor true &&
+ set -m &&
+ start_git_in_background -C cloned pull --recurse-submodules
+'
+
# On a case-insensitive file system, confirm that the daemon
# notices when the .git directory is moved/renamed/deleted
# regardless of how it is spelled in the FS event.