Skip to content

fix: exclude cache and .git from watch filter (fixes #196) - #220

Open
viktorashi wants to merge 1 commit into
SuperCuber:masterfrom
viktorashi:up/watch-filter
Open

fix: exclude cache and .git from watch filter (fixes #196)#220
viktorashi wants to merge 1 commit into
SuperCuber:masterfrom
viktorashi:up/watch-filter

Conversation

@viktorashi

@viktorashi viktorashi commented Aug 9, 2026

Copy link
Copy Markdown

dotter watch redeploys in an infinite loop because the glob filter is inert.

Fixes #196

They found out about this issue long before, and theorised it's something to do with dependencies? idk

Worth considering to merge at least, i believe idk.

Likely root cause:
src/watch.rs passes !-prefixed globs as GlobsetFilterer::new's filters argument (2nd) while leaving ignores (3rd) empty.
Now since the ! prefix is .gitignore negation syntax, the patterns register as whitelists — filters.num_ignores() returns 0, the filter block in watchexec-filterer-globset is skipped entirely, and nothing is ever excluded. Cache writes from deploy retrigger the watcher.

Fix: Move the globs to ignores and drop the !. I think they were always meant to be exclusions??

Tested on macOS (#196 was on Windows, so issue is not OS-specific). Verified with deploy target and log file both safely outside the watched tree:
• 0 deploys on no change
• Exactly 1 deploy per source edit

dotter watch redeploys in an infinite loop because the glob filter is inert.
Root cause: src/watch.rs passes !-prefixed globs as GlobsetFilterer::new's filters argument (2nd) while leaving ignores (3rd) empty. The ! prefix is gitignore negation syntax, so the patterns register as whitelists — filters.num_ignores() returns 0, the filter block in watchexec-filterer-globset is skipped entirely, and nothing is ever excluded. Cache writes from deploy retrigger the watcher.
Fix: Move the globs to ignores and drop the !. The patterns were always meant to be exclusions.
Copilot AI lite review requested due to automatic review settings August 9, 2026 14:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes dotter watch repeatedly redeploying by correcting how file-exclusion globs are provided to watchexec-filterer-globset, ensuring cache writes and .git changes don’t retrigger deployments.

Changes:

  • Pass an empty “filters” list to GlobsetFilterer::new instead of attempting to express exclusions via !-prefixed filter globs.
  • Move cache, .git, and DOTTER_SYMLINK_TEST patterns into the ignore list and remove the ! prefix so they actually exclude those paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

[BUG] Watch mode with post-deploy hook infinitely recurses

2 participants