Skip to content

feat: add worktree strategies and branch sanitization#42

Merged
timvw merged 4 commits intomainfrom
feat/worktree-strategy-rebased
Feb 10, 2026
Merged

feat: add worktree strategies and branch sanitization#42
timvw merged 4 commits intomainfrom
feat/worktree-strategy-rebased

Conversation

@timvw
Copy link
Owner

@timvw timvw commented Feb 10, 2026

Summary

Rebased and improved version of #38 by @brosu — adds configurable worktree placement strategies.

  • Configurable strategies: global (default), sibling-repo, parent-branches, parent-worktrees, parent-dotdir, inside-dotdir, custom
  • Template variables: {.branch}, {.branchSafe}, {.repo.Name}, {.repo.Main}, {.repo.Owner}, {.repo.Host}, {.worktreeRoot}
  • New wt info command to show active strategy, pattern, and available variables
  • Environment variables: WORKTREE_STRATEGY, WORKTREE_PATTERN, WORKTREE_ROOT

Changes on top of #38

  • Bug fix: resolved err variable shadowing in getRepoInfo() where the common-dir fallback could pollute the remote URL check, producing wrong Host/Owner values
  • Unit tests: added parseRemoteURL negative-case tests (empty, no-path, single-component, etc.)
  • E2E tests: added coverage for wt checkout and wt remove with non-global strategy, wt info output, and invalid strategy name
  • Shell completions: added info to bash, zsh, and PowerShell completion lists
  • README: updated features section, added wt info to commands, added discovery hint in configuration section

Test results

  • Unit tests: all pass
  • E2E tests: 96 passed, 0 failed, 8 skipped (platform-specific)

Based on #38 — thank you @brosu for the original implementation!

brosu and others added 2 commits February 10, 2026 08:23
- Fix variable shadowing bug where err from git-common-dir could
  pollute the remote URL check, causing wrong Host/Owner values
- Add parseRemoteURL negative-case unit tests (empty, no-path, etc.)
- Add E2E tests for checkout/remove with non-global strategy
- Add E2E tests for wt info command and invalid strategy name
- Add wt info to shell completion lists (bash, zsh, powershell)
- Update README with wt info command and configurable strategies
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 30.79585% with 200 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.67%. Comparing base (1c8295a) to head (fc49046).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
main.go 39.55% 129 Missing and 7 partials ⚠️
e2e/run.go 0.00% 64 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #42      +/-   ##
==========================================
+ Coverage   23.15%   24.67%   +1.52%     
==========================================
  Files           3        3              
  Lines        1071     1313     +242     
==========================================
+ Hits          248      324      +76     
- Misses        788      948     +160     
- Partials       35       41       +6     
Files with missing lines Coverage Δ
e2e/run.go 0.00% <0.00%> (ø)
main.go 31.35% <39.55%> (+2.57%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add env field to E2E Step struct so environment variables can be set
portably across bash, zsh, and PowerShell. This replaces inline
VAR=value command syntax (bash-only) with proper export/: emission
per shell, fixing failures on Linux and Windows.
The script(1) PTY wrapper on Linux does not propagate exit codes,
causing tests that expect exit_code: 1 to fail. Use skip_shellenv
and call $WT_BIN directly for error-path tests, consistent with
how remove/remove_nonexistent_fails already works.
@timvw timvw merged commit 41aa43f into main Feb 10, 2026
11 checks passed
@timvw timvw deleted the feat/worktree-strategy-rebased branch February 10, 2026 08:13
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.

2 participants