Message ID | pull.1802.v4.git.1728000433326.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 435a6900d27767014b10da79249a50f4bd6a0944 |
Headers | show |
Series | [v4] fsmonitor OSX: fix hangs for submodules | expand |
"Koji Nakamaru via GitGitGadget" <gitgitgadget@gmail.com> writes: > ... The test is > disabled for MINGW because hangs treated with this patch occur only for > Darwin and there is no simple way to terminate the win32 fsmonitor > daemon that hangs. > ... > @@ t/t7527-builtin-fsmonitor.sh: test_expect_success "submodule absorbgitdirs impli > + done > +} > + > -+test_expect_success "submodule implicitly starts daemon by pull" ' > ++test_expect_success !MINGW "submodule implicitly starts daemon by pull" ' > + test_atexit "stop_watchdog" && > + test_when_finished "stop_git; rm -rf cloned super sub" && > + Let me update !MINGW to !WINDOWS while queuing.
On 04/10/2024 18:44, Junio C Hamano wrote: > "Koji Nakamaru via GitGitGadget" <gitgitgadget@gmail.com> writes: > >> ... The test is >> disabled for MINGW because hangs treated with this patch occur only for >> Darwin and there is no simple way to terminate the win32 fsmonitor >> daemon that hangs. >> ... >> @@ t/t7527-builtin-fsmonitor.sh: test_expect_success "submodule absorbgitdirs impli >> + done >> +} >> + >> -+test_expect_success "submodule implicitly starts daemon by pull" ' >> ++test_expect_success !MINGW "submodule implicitly starts daemon by pull" ' >> + test_atexit "stop_watchdog" && >> + test_when_finished "stop_git; rm -rf cloned super sub" && >> + > > Let me update !MINGW to !WINDOWS while queuing. > While this won't hurt, this test file is skipped on cygwin: [23:19:33] t7527-builtin-fsmonitor.sh ......................... skipped: fsmonitor--daemon is not supported on this platform (my eternal TODO list has an 'fsmonitor on cygwin?' item ...) Thanks. ATB, Ramsay Jones
Ramsay Jones <ramsay@ramsayjones.plus.com> writes: > While this won't hurt, this test file is skipped on cygwin: > > [23:19:33] t7527-builtin-fsmonitor.sh ......................... skipped: fsmonitor--daemon is not supported on this platform > > (my eternal TODO list has an 'fsmonitor on cygwin?' item ...) Thanks, then let's not bother.
On Sat, Oct 5, 2024 at 2:44 AM Junio C Hamano <gitster@pobox.com> wrote: > > ... The test is > > disabled for MINGW because hangs treated with this patch occur only for > > Darwin and there is no simple way to terminate the win32 fsmonitor > > daemon that hangs. > > ... > > @@ t/t7527-builtin-fsmonitor.sh: test_expect_success "submodule absorbgitdirs impli > > + done > > +} > > + > > -+test_expect_success "submodule implicitly starts daemon by pull" ' > > ++test_expect_success !MINGW "submodule implicitly starts daemon by pull" ' > > + test_atexit "stop_watchdog" && > > + test_when_finished "stop_git; rm -rf cloned super sub" && > > + > > Let me update !MINGW to !WINDOWS while queuing. I see, Thank you. Koji Nakamaru
diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c index dce8a3b2482..e1e6b96d09e 100644 --- a/builtin/fsmonitor--daemon.c +++ b/builtin/fsmonitor--daemon.c @@ -1314,6 +1314,7 @@ static int fsmonitor_run_daemon(void) strbuf_reset(&state.path_gitdir_watch); strbuf_addstr(&state.path_gitdir_watch, absolute_path(repo_get_git_dir(the_repository))); + strbuf_strip_suffix(&state.path_gitdir_watch, "/."); state.nr_paths_watching = 2; } diff --git a/t/t7527-builtin-fsmonitor.sh b/t/t7527-builtin-fsmonitor.sh index 730f3c7f810..9b15baa02d3 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.