]> git.ipfire.org Git - thirdparty/git.git/commit
fsmonitor OSX: fix hangs for submodules
authorKoji Nakamaru <koji.nakamaru@gree.net>
Fri, 4 Oct 2024 00:07:13 +0000 (00:07 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 4 Oct 2024 15:01:27 +0000 (08:01 -0700)
commit435a6900d27767014b10da79249a50f4bd6a0944
tree9484b507a263b362108c82bd6c03e0af1b995829
parent3857aae53f3633b7de63ad640737c657387ae0c6
fsmonitor OSX: fix hangs for submodules

fsmonitor_classify_path_absolute() expects state->path_gitdir_watch.buf
has no trailing '/' or '.' For a submodule, fsmonitor_run_daemon() sets
the value with trailing "/." (as repo_get_git_dir(the_repository) on
Darwin returns ".") so that fsmonitor_classify_path_absolute() returns
IS_OUTSIDE_CONE.

In this case, fsevent_callback() doesn't update cookie_list so that
fsmonitor_publish() does nothing and with_lock__mark_cookies_seen() is
not invoked.

As with_lock__wait_for_cookie() infinitely waits for state->cookies_cond
that with_lock__mark_cookies_seen() should unlock, the whole daemon
hangs.

Remove trailing "/." from state->path_gitdir_watch.buf for submodules
and add a corresponding test in t7527-builtin-fsmonitor.sh. 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.

Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Koji Nakamaru <koji.nakamaru@gree.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsmonitor--daemon.c
t/t7527-builtin-fsmonitor.sh