Skip to content

Commit dd73519

Browse files
authored
"Branch does not exist locally" while rebasing (#8546)
Fixes #8487
1 parent 23a4df1 commit dd73519

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/github/createPRViewProvider.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,14 +667,17 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
667667
}
668668

669669
public async setDefaultCompareBranch(compareBranch: Branch | undefined) {
670-
this._defaultCompareBranch = compareBranch!.name!;
671-
this.model.setCompareBranch(compareBranch!.name);
672-
this.changeBranch(compareBranch!.name!, false).then(async titleAndDescription => {
670+
if (!compareBranch?.name) {
671+
return;
672+
}
673+
this._defaultCompareBranch = compareBranch.name;
674+
this.model.setCompareBranch(compareBranch.name);
675+
this.changeBranch(compareBranch.name, false).then(async titleAndDescription => {
673676
const params: Partial<CreateParamsNew> = {
674677
defaultTitle: titleAndDescription.title,
675678
defaultDescription: titleAndDescription.description,
676-
compareBranch: compareBranch?.name,
677-
defaultCompareBranch: compareBranch?.name,
679+
compareBranch: compareBranch.name,
680+
defaultCompareBranch: compareBranch.name,
678681
warning: await this.existingPRMessage(),
679682
};
680683
return this._postMessage({

0 commit comments

Comments
 (0)