Skip to content

Improves branch deletion by avoiding the use of the terminal #4359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2025

Conversation

eamodio
Copy link
Member

@eamodio eamodio commented Jun 2, 2025

Refs: #3528

Overview

Replaces the terminal-based branch deletion approach with direct Git API calls that provide better error handling and user experience.

Key Improvements

Enhanced Error Handling

  • Adds specific error types and reasons for branch operations including already exists, not fully merged, invalid names, and missing remote references
  • Provides contextual error messages that help users understand what went wrong and why

Better User Experience

  • Shows confirmation dialog when attempting to delete unmerged branches, allowing users to force delete if desired
  • Handles both local and remote branch deletions through the same interface
  • Processes multiple branch deletions individually to avoid failing entire operations due to single branch issues

API Consistency

  • Standardizes error handling patterns across branch and tag operations
  • Adds dedicated methods for local and remote branch deletion that mirror existing tag operations
  • Improves logging by including operation context in error messages

Technical Changes

  • Introduces BranchError class with specific error reasons for different failure scenarios
  • Adds deleteLocalBranch and deleteRemoteBranch methods to the branches sub-provider
  • Updates push operations to handle remote reference deletion errors
  • Refactors branch deletion logic to iterate through references individually rather than batch processing

@eamodio eamodio requested a review from axosoft-ramint June 2, 2025 17:08
@axosoft-ramint axosoft-ramint self-assigned this Jun 2, 2025
Copy link
Contributor

@axosoft-ramint axosoft-ramint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, works fine

@axosoft-ramint axosoft-ramint merged commit e0a643b into main Jun 2, 2025
3 checks passed
@axosoft-ramint axosoft-ramint deleted the debt/branch-delete branch June 2, 2025 21:31
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.

Change branch terminal-run commands into normal commands w/ proper error handling
2 participants