zed/crates/worktree
Lukas Wirth b1b412ddb3
worktree: Suppress bare .git events explained by filtered sibling events (#61636)
Fixes an infinite git-rescan loop on Windows introduced by #59876.

On Windows, creating or deleting a file directly inside .git updates the
directory's last-write time, so ReadDirectoryChangesW reports a bare
.git Changed event alongside the file's own event. Since #59876, bare
.git events schedule a git rescan (to cope with coalesced FSEvents on
macOS), so every filtered-out lock-file event still triggered a rescan
through its paired bare event. Because a rescan's own `git diff
--numstat HEAD` can take .git/index.lock (even under
--no-optional-locks, e.g. in jj-colocated repos whose index never
refreshes clean), each rescan re-triggered the next one, spawning ~9 git
processes per cycle, ~4 cycles/sec, indefinitely.

Bare .git events are now deferred while processing an event batch and
only trigger a rescan when the batch contains no filtered event for the
same git dir that explains the directory change. A standalone bare .git
event (the macOS coalescing case #59876 addressed) still triggers a
rescan, as does any batch containing a meaningful .git change.


Release Notes:

- N/A or Added/Fixed/Improved ...
2026-07-25 10:18:26 +00:00
..
src worktree: Suppress bare .git events explained by filtered sibling events (#61636) 2026-07-25 10:18:26 +00:00
tests/integration worktree: Suppress bare .git events explained by filtered sibling events (#61636) 2026-07-25 10:18:26 +00:00
Cargo.toml Fix the filtering of index.lock + COMMIT_MESSAGE FS events to work in linked worktrees (#57763) 2026-05-27 00:04:30 +00:00
LICENSE-GPL