Match ignore patterns against worktree folder name as well as branch#74
Merged
Conversation
Renames the global config key ignoreBranchPatterns to ignoreWorktreePatterns. A worktree is now ignored when any pattern matches either its branch name or its folder name (last path segment), so detached-HEAD worktrees can also be ignored by directory name. - TreemonConfig: rename reader to readIgnoreWorktreePatterns; predicate signature unchanged (string -> bool), now used against either string. - RefreshScheduler: new isWorktreeIgnored helper combines branch and folder checks; resolveIgnoredPaths and both call sites use it. - WorktreeApi: remove trivial private wrappers around TreemonConfig and reuse RefreshScheduler.isWorktreeIgnored so the OR-logic lives in one place. - Tests: add folder-match cases including detached-HEAD worktrees; update test name that referred specifically to branch names. Breaking change: existing configs using ignoreBranchPatterns must rename the key to ignoreWorktreePatterns.
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.
Problem
Worktree ignore patterns previously only matched against branch names, so detached-HEAD worktrees (no branch) could never be ignored regardless of folder name. The config key
ignoreBranchPatternsalso implied a narrower scope than was useful in practice — users often want to filter by directory naming convention (e.g.archive-*) rather than branch.Changes
ignoreBranchPatterns→ignoreWorktreePatterns.RefreshScheduler.isWorktreeIgnoredhelper combines both checks;resolveIgnoredPathsand theWorktreeApifilter both use it so the OR-logic lives in one place.WorktreeApi: removed trivial private wrappers (readIgnoreBranchPatterns,buildIgnorePredicate) and callTreemonConfig/RefreshSchedulerdirectly.Worktree with no branch is not ignoredinto two cases covering folder match / no match.Breaking change
Existing global config files must rename
ignoreBranchPatternstoignoreWorktreePatterns. Patterns continue to work as plain regexes — the only change is that they now also match against the worktree folder name.Files
src/Server/RefreshScheduler.fssrc/Server/TreemonConfig.fssrc/Server/WorktreeApi.fssrc/Tests/SchedulerTests.fsTests
dotnet build treemon.slnxand the scheduler test suite cover the renamed and new cases (Matches worktrees by folder name,Worktree with no branch is ignored when folder matches,Worktree with no branch is not ignored when folder does not match).