Skip to content

Commit 80e46a2

Browse files
committed
argument clean up and keep branch name
1 parent fab1204 commit 80e46a2

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/commands.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -826,21 +826,17 @@ export function registerCommands(
826826
);
827827

828828
context.subscriptions.push(
829-
vscode.commands.registerCommand('pr.pickInWorktree', async (pr: PRNode | RepositoryChangesNode | PullRequestModel) => {
830-
if (pr === undefined) {
829+
vscode.commands.registerCommand('pr.pickInWorktree', async (pr: PRNode | unknown) => {
830+
if (pr === undefined || !(pr instanceof PRNode)) {
831831
Logger.error('Unexpectedly received undefined when picking a PR for worktree checkout.', logId);
832832
return vscode.window.showErrorMessage(vscode.l10n.t('No pull request was selected to checkout, please try again.'));
833833
}
834834

835835
let pullRequestModel: PullRequestModel;
836836
let repository: Repository | undefined;
837837

838-
if (pr instanceof PRNode || pr instanceof RepositoryChangesNode) {
839-
pullRequestModel = pr.pullRequestModel;
840-
repository = pr.repository;
841-
} else {
842-
pullRequestModel = pr;
843-
}
838+
pullRequestModel = pr.pullRequestModel;
839+
repository = pr.repository;
844840

845841
// Validate that the PR has a valid head branch
846842
if (!pullRequestModel.head) {
@@ -904,7 +900,7 @@ export function registerCommands(
904900
progress.report({ message: vscode.l10n.t('Creating worktree at {0}...', worktreePath) });
905901

906902
const trackedBranchName = `${remoteName}/${branchName}`;
907-
const localBranchName = `pr-${pullRequestModel.number}-${branchName}`;
903+
const localBranchName = branchName;
908904

909905
try {
910906
// Create a VS Code task to execute the git worktree command

0 commit comments

Comments
 (0)