fix: exclude cache and .git from watch filter (fixes #196) - #220
Open
viktorashi wants to merge 1 commit into
Open
fix: exclude cache and .git from watch filter (fixes #196)#220viktorashi wants to merge 1 commit into
viktorashi wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
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::newinstead of attempting to express exclusions via!-prefixed filter globs. - Move cache,
.git, andDOTTER_SYMLINK_TESTpatterns 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dotter watchredeploys 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.rspasses!-prefixed globs asGlobsetFilterer::new's filters argument (2nd) while leaving ignores (3rd) empty.Now since the
!prefix is.gitignorenegation syntax, the patterns register as whitelists —filters.num_ignores()returns 0, the filter block inwatchexec-filterer-globsetis 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