Prompt for local branch cleanup after GitHub auto-delete - #8908
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
| const deleteBranchAfterMerge = vscode.workspace.getConfiguration(PR_SETTINGS_NAMESPACE).get<boolean>(DELETE_BRANCH_AFTER_MERGE, false); | ||
| if (deleteBranchAfterMerge) { | ||
| await autoDeleteBranchesAfterMerge(folderRepositoryManager, item); | ||
| } else if ((await item.githubRepository.getMetadata()).delete_branch_on_merge) { |
There was a problem hiding this comment.
We don't want to key off of github "delete on merge" setting.
|
Copilot I don't see any more commits |
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Addressed in |
This reverts commit 494f592.
There was a problem hiding this comment.
Pull request overview
This PR addresses a merge-flow gap where, if GitHub auto-deletes the remote branch after merging, the extension can skip the local cleanup flow (leaving the PR branch checked out). It centralizes post-merge branch cleanup behavior and ensures merge success is reported before any cleanup prompting occurs.
Changes:
- Introduces a centralized
handleBranchDeletionAfterMergehelper to coordinate post-merge cleanup (auto-delete vs. prompt based on repo metadata). - Updates both merge entry points (PR overview webview + activity bar view) to report merge success first, then perform/prompt for cleanup without masking a successful merge on cleanup failure.
- Adds a test to ensure the local deletion picker is shown when GitHub’s
delete_branch_on_mergeis enabled.
Show a summary per file
| File | Description |
|---|---|
| src/test/github/pullRequestOverview.test.ts | Adds coverage asserting the deletion picker is shown and merge success is replied before prompting. |
| src/github/pullRequestReviewCommon.ts | Centralizes post-merge cleanup logic and adds guarded error logging for cleanup failures. |
| src/github/pullRequestOverview.ts | Uses the centralized cleanup helper after replying merge success, then posts cleanup messages if needed. |
| src/github/activityBarViewProvider.ts | Aligns the activity bar merge flow with the centralized post-merge cleanup behavior. |
| src/@types/vscode.proposed.chatParticipantAdditions.d.ts | Updates the proposed chat participant type definition for auto-mode routing resolution. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 4/5 changed files
- Comments generated: 1
- Review effort level: Lite
When GitHub automatically deleted a merged PR’s remote branch, VS Code skipped local cleanup, leaving the PR branch checked out.
Changes
delete_branch_on_mergeis enabled, open the existing deletion picker for local cleanup.