Skip to content

Commit b13ee49

Browse files
Updates wording and fetches branch if not in list
1 parent a2da46c commit b13ee49

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/webviews/home/homeWebview.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,18 +1174,24 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
11741174

11751175
private async deleteBranchOrWorktree(ref: BranchRef, mergeTarget?: BranchRef) {
11761176
const repo = this._repositoryBranches.get(ref.repoPath);
1177-
const branch = repo?.branches.find(b => b.id === ref.branchId);
1177+
let branch = repo?.branches.find(b => b.id === ref.branchId);
1178+
if (branch == null) {
1179+
branch = await repo?.repo.git.branches().getBranch(ref.branchId);
1180+
}
1181+
11781182
const worktree = branch ? repo?.worktreesByBranch.get(branch.id) : undefined;
11791183
if (branch == null) return;
1184+
11801185
if (branch.current && mergeTarget != null && (!worktree || worktree.isDefault)) {
11811186
const mergeTargetLocalBranchName = getBranchNameWithoutRemote(mergeTarget.branchName);
11821187
const confirm = await window.showWarningMessage(
1183-
`The merge target branch ${mergeTargetLocalBranchName} will be checked out before deleting the current branch ${branch.name}.`,
1188+
`Before deleting the current branch '${branch.name}', you will be switched to '${mergeTargetLocalBranchName}'.`,
11841189
{ modal: true },
1185-
{ title: 'Proceed' },
1190+
{ title: 'Continue' },
11861191
);
11871192

1188-
if (confirm == null || confirm.title !== 'Proceed') return;
1193+
if (confirm == null || confirm.title !== 'Continue') return;
1194+
11891195
await this.container.git.checkout(ref.repoPath, mergeTargetLocalBranchName);
11901196

11911197
void executeGitCommand({
@@ -1202,12 +1208,13 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
12021208
if (defaultWorktree == null || commonRepo == null) return;
12031209

12041210
const confirm = await window.showWarningMessage(
1205-
`You will be returned to the default worktree before deleting the worktree for ${branch.name}.`,
1211+
`Before deleting the worktree for '${branch.name}', you will be switched to the default worktree.`,
12061212
{ modal: true },
1207-
{ title: 'Proceed' },
1213+
{ title: 'Continue' },
12081214
);
12091215

1210-
if (confirm == null || confirm.title !== 'Proceed') return;
1216+
if (confirm == null || confirm.title !== 'Continue') return;
1217+
12111218
const schemeOverride = configuration.get('deepLinks.schemeOverride');
12121219
const scheme = typeof schemeOverride === 'string' ? schemeOverride : env.uriScheme;
12131220
const deleteBranchDeepLink = {

0 commit comments

Comments
 (0)