Skip to content

Match ignore patterns against worktree folder name as well as branch#74

Merged
0101 merged 2 commits into
mainfrom
ignore-by-folder
May 11, 2026
Merged

Match ignore patterns against worktree folder name as well as branch#74
0101 merged 2 commits into
mainfrom
ignore-by-folder

Conversation

@0101
Copy link
Copy Markdown
Owner

@0101 0101 commented May 11, 2026

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 ignoreBranchPatterns also 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

  • Rename config key ignoreBranchPatternsignoreWorktreePatterns.
  • A worktree is now ignored when any pattern matches either its branch name or its folder name (last path segment).
  • New RefreshScheduler.isWorktreeIgnored helper combines both checks; resolveIgnoredPaths and the WorktreeApi filter both use it so the OR-logic lives in one place.
  • WorktreeApi: removed trivial private wrappers (readIgnoreBranchPatterns, buildIgnorePredicate) and call TreemonConfig / RefreshScheduler directly.
  • Tests: new cases for folder-name matching including detached-HEAD worktrees; renamed Worktree with no branch is not ignored into two cases covering folder match / no match.

Breaking change

Existing global config files must rename ignoreBranchPatterns to ignoreWorktreePatterns. 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.fs
  • src/Server/TreemonConfig.fs
  • src/Server/WorktreeApi.fs
  • src/Tests/SchedulerTests.fs

Tests

dotnet build treemon.slnx and 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).

0101 added 2 commits May 11, 2026 12:50
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.
@0101 0101 merged commit 0cc8cbe into main May 11, 2026
1 check passed
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.

1 participant