Skip to content

✨ feat(cli): resolve repo context from worktrees directory#27

Merged
iamrajjoshi merged 1 commit intomainfrom
feat--worktrees-dir-context
Feb 15, 2026
Merged

✨ feat(cli): resolve repo context from worktrees directory#27
iamrajjoshi merged 1 commit intomainfrom
feat--worktrees-dir-context

Conversation

@iamrajjoshi
Copy link
Owner

Summary

  • Adds ResolveRepoFromDir helper that maps ~/.willow/worktrees/<name>/ to ~/.willow/repos/<name>.git
  • Updates requireWillowRepo (used by rm, run, prune, pwd, init, config set/edit) to fall back to this resolution
  • Updates ls, config list, config get, and tab completion to also use the fallback

Context

Previously, commands only worked from inside a specific worktree (where git rev-parse --git-common-dir succeeds). Running ww ls from ~/.willow/worktrees/evergreen/ would fall through to listing all repos instead of showing that repo's worktrees. This was unintuitive since users often cd into the repo's worktrees directory to browse branches.

Test plan

  • go build && go test ./... passes
  • ww ls from ~/.willow/worktrees/evergreen/ lists evergreen's worktrees
  • ww ls from /tmp still shows the repo list

Commands like `ww ls`, `ww pwd`, `ww config`, `ww rm`, `ww run`, and
`ww prune` now work when run from ~/.willow/worktrees/<name>/, not just
from inside a specific worktree. This is more intuitive since users
often cd into the repo's worktrees directory to browse branches.
@iamrajjoshi iamrajjoshi merged commit 845e5de into main Feb 15, 2026
2 checks passed
@iamrajjoshi iamrajjoshi deleted the feat--worktrees-dir-context branch February 15, 2026 03:19
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