Skip to content

Watch worktrees with parcel and skip ignored directories - #1086

Merged
thesiti92 merged 3 commits into
mainfrom
fix/linux-git-watch-budget
Oct 11, 2026
Merged

thesiti92 merged 3 commits into
mainfrom
fix/linux-git-watch-budget

Conversation

@thesiti92

Copy link
Copy Markdown
Contributor

Fixes #1073.

On Linux, Node's recursive fs.watch adds an inotify watch for every file and every directory. The git directory watch also covered every managed review checkout under .git/dev-fast, plus objects and logs. The root watch covered gitignored directories such as node_modules. #982 only filtered events and never cut how many watches were registered, so one review could use up fs.inotify.max_user_watches for every process of the user.

Change

  • Worktrees are watched with @parcel/watcher 2.6.0, which adds one inotify watch per directory, never per file. It loads on first use, and if it fails to load, the worktree re-inspects on every request, as a failed watcher did before.
  • The root watch skips .git and the gitignored directories git reports (ls-files --others --ignored --exclude-standard --directory), so nested .gitignore, info/exclude and core.excludesFile all apply.
  • The git directory watch skips objects, logs, lfs and dev-fast. Events there no longer count either.
  • A directory that appears inside a tracked one, or a .gitignore or info/exclude change, re-reads the ignored list and re-subscribes.

Measured

Fedora 44 (QEMU), the 0.2.4 preview with this runtime swapped in. The fixture repo has a gitignored node_modules and three managed checkouts.

before after
Desktop review host 32,003 332
whiteboard server (headless) 31,999 328
After a new gitignored target/ with 2,000 directories — 332 / 328

Edits to tracked files still update the review in both modes.

Notes

  • Parcel's install script only builds from source when asked, so it stays disabled in allowBuilds. The prebuilt binaries arrive as optional dependencies. About 1.4 MB per platform.
  • On macOS parcel reports changes after about 70 ms (FSEvents) instead of about 11 ms, so the tests that slept before refreshWorktrees now share a 200 ms wait.
  • A new Linux-only test counts the process's inotify watches.

Prebuilt per platform; its install script only builds from source, so it stays off.
On Linux, recursive fs.watch adds an inotify watch per file and per
directory, including every managed review checkout under .git/dev-fast.
Parcel watches directories only. The checkout watch skips .git, and the
git directory watch skips objects, logs, lfs and dev-fast.
@thesiti92
thesiti92 force-pushed the fix/linux-git-watch-budget branch from aa16d4a to 6a4f019 Compare October 11, 2026 01:38
The checkout watch ignores what git reports as ignored, such as
node_modules. A new directory inside a tracked one, or a .gitignore or
info/exclude change, rereads that list and resubscribes.

Fixes #1073.
@thesiti92
thesiti92 force-pushed the fix/linux-git-watch-budget branch from 6a4f019 to f9a369e Compare October 11, 2026 01:54
@thesiti92
thesiti92 merged commit ca83580 into main Oct 11, 2026
3 checks passed
@thesiti92
thesiti92 deleted the fix/linux-git-watch-budget branch October 11, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux: recursive watch of the Git common directory registers an inotify watch per directory inside .git/dev-fast/reviews (650k+ watches, ENOSPC)

2 participants