Skip to content

Commit 2d0caf4

Browse files
Fixes remote and open branch matching on base ref
1 parent ecd2860 commit 2d0caf4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/plus/launchpad/launchpadProvider.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export type LaunchpadItem = LaunchpadPullRequest & {
109109

110110
export type OpenRepository = {
111111
repo: Repository;
112-
remote: GitRemote;
112+
remote?: GitRemote;
113113
localBranch?: GitBranch;
114114
};
115115

@@ -551,12 +551,16 @@ export class LaunchpadProvider implements Disposable {
551551
): Promise<OpenRepository | undefined> {
552552
if (pr.repoIdentity.remote.url == null) return undefined;
553553

554-
const match =
555-
matchingRemoteMap.get(pr.repoIdentity.remote.url) ??
556-
(pr.underlyingPullRequest?.refs?.base?.url
557-
? matchingRemoteMap.get(pr.underlyingPullRequest.refs.base.url)
558-
: undefined);
559-
if (match == null) return undefined;
554+
let match = matchingRemoteMap.get(pr.repoIdentity.remote.url);
555+
if (match == null) {
556+
if (pr.underlyingPullRequest?.refs?.base?.url == null) return undefined;
557+
558+
match = matchingRemoteMap.get(pr.underlyingPullRequest.refs.base.url);
559+
if (match == null) return undefined;
560+
561+
const [repo] = match;
562+
return { repo: repo };
563+
}
560564

561565
const [repo, remote] = match;
562566

0 commit comments

Comments
 (0)