Skip to content

🐛 bug(various fixes): Improve error handling, UX, and robustness#28

Merged
iamrajjoshi merged 1 commit intomainfrom
feat--improvements
Feb 15, 2026
Merged

🐛 bug(various fixes): Improve error handling, UX, and robustness#28
iamrajjoshi merged 1 commit intomainfrom
feat--improvements

Conversation

@iamrajjoshi
Copy link
Owner

Summary

  • Fix silent post-checkout hook errorsrunPostCheckoutHook now warns via ui.Warn when the hook fails instead of silently swallowing the error
  • Fix HasUnpushedCommits swallowing all errors — only treats "no upstream" as unpushed; real git errors (network, permission, corruption) are now propagated
  • Fix branch name collision from slash strippingfeature/auth now creates directory feature-auth instead of featureauth, preventing collisions with a branch literally named featureauth
  • Add cleanup on partial clone failure — if any step after the bare clone fails (fetch, config, worktree creation), both bareDir and worktreesDir are cleaned up
  • Add interactive worktree picker for pwd — when called with no argument, shows a numbered list and prompts for selection (also makes wwg with no args work interactively)
  • Expose postCheckoutHook in ww config CLI — now visible in --list, gettable and settable via ww config postCheckoutHook <path>
  • Improve run --all result aggregation — tracks failures and returns a summary error like command failed in 2/5 worktrees: main, payments

Also verified:

  • Error wrapping already uses %w consistently (no %v found)
  • Shell completion is correctly using --generate-shell-completion per urfave/cli/v3 API

Test plan

  • All 34 existing + new tests pass (go test ./...)
  • go vet ./... clean
  • Manual verification: ww config --list shows postCheckoutHook
  • Manual verification: --generate-shell-completion returns all subcommands
  • Manual verification: shell-init detects bash/zsh correctly
  • Integration test for slashed branch directory naming (TestNew_SlashedBranchDirName)
  • Integration test for postCheckoutHook config set (TestConfig_PostCheckoutHook)
  • Unit test for empty worktree picker (TestPickWorktree_EmptyList)

- Fix silent error in runPostCheckoutHook — now warns on failure
- Fix HasUnpushedCommits swallowing all git errors — only treats
  "no upstream" as unpushed, propagates real errors
- Fix branch name collision from slash stripping — feature/auth now
  creates directory feature-auth instead of featureauth
- Add cleanup on partial clone failure — removes bare repo and
  worktrees dir if any post-clone step fails
- Add interactive worktree picker for pwd — numbered list when
  called with no argument
- Expose postCheckoutHook in ww config CLI — list, get, and set
- Improve run --all result aggregation — reports failed worktrees
  in summary error
- Add tests for new behavior
@iamrajjoshi iamrajjoshi changed the title Improve error handling, UX, and robustness 🐛 bug(various fixes): Improve error handling, UX, and robustness Feb 15, 2026
@iamrajjoshi iamrajjoshi marked this pull request as ready for review February 15, 2026 22:25
@iamrajjoshi iamrajjoshi merged commit 0a2ab88 into main Feb 15, 2026
2 checks passed
@iamrajjoshi iamrajjoshi deleted the feat--improvements branch February 15, 2026 22:25
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