Skip to content

fix: correct branch naming pattern in delete command (#77)#78

Merged
aku11i merged 3 commits into
mainfrom
issue-77
Jun 3, 2025
Merged

fix: correct branch naming pattern in delete command (#77)#78
aku11i merged 3 commits into
mainfrom
issue-77

Conversation

@aku11i

@aku11i aku11i commented Jun 3, 2025

Copy link
Copy Markdown
Collaborator

Summary

  • Fixed incorrect branch naming pattern in phantom delete command that prevented branches from being deleted
  • Improved error handling to report branch deletion failures instead of silently ignoring them

Details

The delete command was attempting to delete branches with the pattern phantom/worktrees/${name}, but branches are actually created with just the worktree name (e.g., feature instead of phantom/worktrees/feature).

This PR updates the branch deletion logic to use the correct branch name and adds proper error reporting when branch deletion fails.

Test plan

  • Updated unit tests to verify correct branch name is used
  • Added test case for when branch deletion fails
  • All tests pass with pnpm ready

Fixes #77

🤖 Generated with Claude Code

aku11i and others added 3 commits June 3, 2025 22:10
…n pattern

The delete command was trying to delete branches with the pattern
`phantom/worktrees/${name}` but branches are actually created with
just the worktree name. This fix ensures branches are properly
deleted when removing worktrees.

Also improves error handling to report branch deletion failures
instead of silently ignoring them.

Fixes #77

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…error handling

Updated deleteBranch to return Result<boolean, GitOperationError> instead of
a custom object, following the established pattern in the codebase for
type-safe error handling.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Each test has its own mock context, so explicit reset calls are not needed.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@aku11i
aku11i merged commit 1a2fab6 into main Jun 3, 2025
@aku11i
aku11i deleted the issue-77 branch June 3, 2025 13:19
tsukimiya pushed a commit to tsukimiya/phantom that referenced this pull request Nov 2, 2025
…phantompane#78)

* fix: correct branch naming pattern in delete command to match creation pattern

The delete command was trying to delete branches with the pattern
`phantom/worktrees/${name}` but branches are actually created with
just the worktree name. This fix ensures branches are properly
deleted when removing worktrees.

Also improves error handling to report branch deletion failures
instead of silently ignoring them.

Fixes phantompane#77

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: use Result<T> type in deleteBranch function for consistent error handling

Updated deleteBranch to return Result<boolean, GitOperationError> instead of
a custom object, following the established pattern in the codebase for
type-safe error handling.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: remove unnecessary mock.reset() calls from tests

Each test has its own mock context, so explicit reset calls are not needed.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

phantom delete fails to delete git branches due to incorrect branch name pattern

1 participant