]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'pt/fsmonitor-linux' into next
authorJunio C Hamano <gitster@pobox.com>
Mon, 13 Apr 2026 20:58:18 +0000 (13:58 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Apr 2026 20:58:18 +0000 (13:58 -0700)
The fsmonitor daemon has been implemented for Linux.

* pt/fsmonitor-linux:
  fsmonitor: convert shown khash to strset in do_handle_client
  fsmonitor: add tests for Linux
  fsmonitor: add timeout to daemon stop command
  fsmonitor: close inherited file descriptors and detach in daemon
  run-command: add close_fd_above_stderr option
  fsmonitor: implement filesystem change listener for Linux
  fsmonitor: rename fsm-settings-darwin.c to fsm-settings-unix.c
  fsmonitor: rename fsm-ipc-darwin.c to fsm-ipc-unix.c
  fsmonitor: use pthread_cond_timedwait for cookie wait
  compat/win32: add pthread_cond_timedwait
  fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon
  fsmonitor: fix khash memory leak in do_handle_client
  t9210, t9211: disable GIT_TEST_SPLIT_INDEX for scalar clone tests

1  2 
Makefile
config.mak.uname
contrib/buildsystems/CMakeLists.txt
meson.build
run-command.c
run-command.h
t/t7527-builtin-fsmonitor.sh

diff --cc Makefile
Simple merge
Simple merge
Simple merge
diff --cc meson.build
index 11488623bfd8f8303cb3e870d700b2072cffffdb,123d2184602aa94d04ca4802a16fe8c506696a21..63d1e2c5071c204b223760f409d5e9f3ddc4ff15
@@@ -1354,12 -1337,12 +1361,12 @@@ if fsmonitor_backend != '
    libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
    libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
  
 -  libgit_sources += [
 +  compat_sources += [
      'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
-     'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+     'compat/fsmonitor/fsm-ipc-' + fsmonitor_os + '.c',
      'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
      'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
-     'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+     'compat/fsmonitor/fsm-settings-' + fsmonitor_os + '.c',
    ]
  endif
  build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
diff --cc run-command.c
Simple merge
diff --cc run-command.h
Simple merge
index e7b40654694c9e1cf58f4db0cfbd04b4ad4f9c89,774da5ac60924d0923fea1f96abcae4cc7227f15..b99a940c8dad3c53e7c790fe23c4f603aa424263
@@@ -520,9 -564,33 +569,31 @@@ test_expect_success 'directory changes 
  
        directory_to_file &&
  
 -      test-tool fsmonitor-client query --token 0 &&
 -
 -      grep "^event: dir1$" .git/trace
 +      retry_grep "^event: dir1$" .git/trace
  '
  
+ test_expect_success 'rapid nested directory creation' '
+       test_when_finished "git fsmonitor--daemon stop; rm -rf rapid" &&
+       start_daemon --tf "$PWD/.git/trace" &&
+       # Rapidly create nested directories to exercise race conditions
+       # where directory watches may be added concurrently during
+       # event processing and recursive scanning.
+       for i in $(test_seq 1 20)
+       do
+               mkdir -p "rapid/nested/dir$i/subdir/deep" || return 1
+       done &&
+       # Give the daemon time to process all events
+       sleep 1 &&
+       test-tool fsmonitor-client query --token 0 &&
+       # Verify daemon is still running (did not crash)
+       git fsmonitor--daemon status
+ '
  # The next few test cases exercise the token-resync code.  When filesystem
  # drops events (because of filesystem velocity or because the daemon isn't
  # polling fast enough), we need to discard the cached data (relative to the