Skip to content

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

Description

@aku11i

Description

The phantom delete command is not successfully deleting git branches as intended. The command reports success but leaves the associated git branch in the repository.

Root Cause

The issue occurs because of a mismatch between the branch naming convention:

  • In src/core/worktree/delete.ts:117-118, the code attempts to delete a branch named phantom/worktrees/${name}
  • However, the actual branch names created by phantom don't follow this pattern

Additionally, the deleteBranch function at line 72-83 silently ignores git errors, returning false on failure without reporting the issue to the user.

Current Behavior

  1. User runs phantom delete <name>
  2. The worktree is successfully removed
  3. Branch deletion is attempted but fails silently
  4. User sees "Deleted worktree 'name' and its branch" message even though the branch wasn't deleted
  5. The git branch remains in the repository

Expected Behavior

  1. The correct branch should be identified and deleted
  2. If branch deletion fails, the user should be notified
  3. The success message should accurately reflect what was deleted

Related Issues

Suggested Fix

  1. Investigate the actual branch naming pattern used during worktree creation
  2. Update the branch deletion logic to use the correct branch name
  3. Improve error handling to report branch deletion failures to the user
  4. Consider implementing the --branch flag from issue feat: Add option to delete branch along with phantom in delete command #52 as a workaround

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions