Skip to content

Commit b81a936

Browse files
Fixes issue association being attempted before the branch is created
1 parent c7900ec commit b81a936

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/commands/git/branch.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,18 @@ export class BranchGitCommand extends QuickCommand {
422422

423423
endSteps(state);
424424

425+
if (state.flags.includes('--switch')) {
426+
await state.repo.switch(state.reference.ref, { createBranch: state.name });
427+
} else {
428+
try {
429+
await state.repo.git.createBranch(state.name, state.reference.ref);
430+
} catch (ex) {
431+
Logger.error(ex);
432+
// TODO likely need some better error handling here
433+
return showGenericErrorMessage('Unable to create branch');
434+
}
435+
}
436+
425437
if (state.withIssue != null) {
426438
const issue = state.withIssue;
427439
const branch = await state.repo.git.getBranch(state.name);
@@ -439,18 +451,6 @@ export class BranchGitCommand extends QuickCommand {
439451
await addAssociatedIssueToBranch(this.container, branch, { ...issue, type: 'issue' }, resource);
440452
}
441453
}
442-
443-
if (state.flags.includes('--switch')) {
444-
await state.repo.switch(state.reference.ref, { createBranch: state.name });
445-
} else {
446-
try {
447-
await state.repo.git.createBranch(state.name, state.reference.ref);
448-
} catch (ex) {
449-
Logger.error(ex);
450-
// TODO likely need some better error handling here
451-
return showGenericErrorMessage('Unable to create branch');
452-
}
453-
}
454454
}
455455
}
456456

0 commit comments

Comments
 (0)