Hi Erik, On Tue, 13 Oct 2026 15:39:28 +0200, Erik Cervin-Edin wrote:
> With the built-in fsmonitor daemon on Linux, I renamed a directory that > has a subdirectory, then edited a file in each:
[...]
> Only the file directly in the renamed directory is listed. The daemon > reports the edit in the subdirectory under its path from before the > rename
I can confirm this with the released git 2.56.0 (NixOS, x86_64, core.fsmonitor=true set globally), using a slightly smaller reproduction:     git init repro && cd repro     mkdir -p old/sub     echo a >old/top.txt     echo a >old/sub/f.txt     git add . && git commit -qm init     git status --short          # starts the daemon     git mv old new     git commit -qm rename     echo b >>new/top.txt     echo b >>new/sub/f.txt     GIT_TRACE_FSMONITOR=1 git status --short Only "M new/top.txt" is listed; the trace shows the edit in the subdirectory reported as 'old/sub/f.txt'. "git -c core.fsmonitor=false status --short" lists both files.
> Changes anywhere below a subdirectory of a renamed directory are > missing from status and diff, with no warning.
This bit me in practice as well: after renaming a directory, a whole series of later edits in its subdirectories was silently missing from "git add -A". The resulting commits did not build, while the working tree did, so nothing looked wrong until the commits were checked out on their own.
> I believe the cause is in add_watch() in > compat/fsmonitor/fsm-listen-linux.c. [...] When the rename is > processed, they are registered again under their new paths with > IN_MASK_CREATE, inotify_add_watch() fails with EEXIST, and add_watch() > returns early without updating the descriptor-to-path map.
I came to the same conclusion reading the code on master: after rename_dir(), register_inotify() recurses into the subdirectories and calls add_watch() for each new path, which hits the EEXIST early return, so the watch descriptors of the subdirectories keep their old paths. As far as I can tell, master has no change to fsm-listen-linux.c since the series was merged, and t7527's "rename directory" test only checks the rename event itself, not later edits below the renamed directory, so this is not covered. Until this is fixed, setting core.fsmonitor=false in affected repositories is the only workaround I am aware of; restarting the daemon helps only until the next directory rename. Thanks, Nicolas Riebesel