Repository navigation
watch: ignore files by pattern via .gocutignore and --ignore - #4
Merged
Merged
Conversation
gocut watch reads gitignore-style patterns from .gocutignore in --root, plus any --ignore flags (applied after the file). A matching file never starts a build or a restart, and a matching directory is not watched. Supports name patterns at any depth, root-anchored paths, trailing-slash directory-only patterns, *, ?, [...] classes, ** and ! negation (last match wins; a file under an ignored directory stays ignored). Patterns apply only under --root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AcYXsJeqDL2ULiRzRmtw94
emoss08
marked this pull request as ready for review
November 7, 2026 08:20
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.
Summary
gocut watchcan now ignore files by pattern. It reads gitignore-style patterns from.gocutignorein--root, plus any--ignore <pattern>flags, which are applied after the file. A file that matches never starts a build or a restart. A directory that matches is not watched, which also saves inotify watches.Notes:
_test.gofiles andtestdata/already never started a build. That hasn't changed.*,?,[abc]/[a-z]/[!abc],**,!,#comments, and\escapes. As with gitignore, a file under an ignored directory can't be re-included.--root, so packages reached through areplaceoutside it aren't affected.-toolexeccompile path is unchanged.src/ignore.rs, with unit tests.Testing
cargo fmt --check,cargo clippy --all-targets --locked -- -D warningsandcargo test --locked(35 tests) all pass.skip_dir, andWatcher::considerwith ignored files..gocutignoreand--ignore) started nothing, an edit to a non-ignored file rebuilt, and the ignored directory was not watched.Generated by Claude Code