Skip to content

Commit e4727aa

Browse files
Fixes wrong repo path on branch delete
1 parent 46378fd commit e4727aa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/webviews/home/homeWebview.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,8 +1177,8 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
11771177
const mergeTargetLocalBranchName = getBranchNameWithoutRemote(mergeTarget.branchName);
11781178
const confirm = await window.showWarningMessage(
11791179
`The merge target branch ${mergeTargetLocalBranchName} will be checked out before deleting the current branch ${branch.name}.`,
1180+
{ modal: true },
11801181
{ title: 'Proceed' },
1181-
{ title: 'Cancel' },
11821182
);
11831183

11841184
if (confirm == null || confirm.title !== 'Proceed') return;
@@ -1193,13 +1193,14 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
11931193
},
11941194
});
11951195
} else if (repo != null && branch != null && worktree != null && !worktree.isDefault) {
1196+
const commonRepo = await repo.repo.getCommonRepository();
11961197
const defaultWorktree = [...repo.worktreesByBranch.values()].find(w => w.isDefault);
1197-
if (defaultWorktree == null) return;
1198+
if (defaultWorktree == null || commonRepo == null) return;
11981199

11991200
const confirm = await window.showWarningMessage(
12001201
`You will be returned to the default worktree before deleting the worktree for ${branch.name}.`,
1202+
{ modal: true },
12011203
{ title: 'Proceed' },
1202-
{ title: 'Cancel' },
12031204
);
12041205

12051206
if (confirm == null || confirm.title !== 'Proceed') return;
@@ -1209,9 +1210,9 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
12091210
url: `${scheme}://${this.container.context.extension.id}/${'link' satisfies UriTypes}/${
12101211
DeepLinkType.Repository
12111212
}/-/${DeepLinkType.Branch}/${encodeURIComponent(branch.name)}?path=${encodeURIComponent(
1212-
branch.repoPath,
1213+
commonRepo.path,
12131214
)}&action=delete-branch`,
1214-
repoPath: branch.repoPath,
1215+
repoPath: commonRepo.path,
12151216
useProgress: false,
12161217
state: DeepLinkServiceState.GoToTarget,
12171218
};

0 commit comments

Comments
 (0)