@@ -7,16 +7,24 @@ import type { GitBranchReference } from '../../git/models/reference';
77import type { Repository } from '../../git/models/repository' ;
88import { getAheadBehindFilesQuery , getCommitsQuery } from '../../git/queryResults' ;
99import { getIssueOrPullRequestMarkdownIcon , getIssueOrPullRequestThemeIcon } from '../../git/utils/-webview/icons' ;
10- import { ensurePullRequestRefs , getOrOpenPullRequestRepository } from '../../git/utils/-webview/pullRequest.utils' ;
11- import { getComparisonRefsForPullRequest } from '../../git/utils/pullRequest.utils' ;
10+ import {
11+ ensurePullRequestRefs ,
12+ ensurePullRequestRemote ,
13+ getOrOpenPullRequestRepository ,
14+ } from '../../git/utils/-webview/pullRequest.utils' ;
15+ import {
16+ getComparisonRefsForPullRequest ,
17+ getRepositoryIdentityForPullRequest ,
18+ } from '../../git/utils/pullRequest.utils' ;
1219import { createRevisionRange } from '../../git/utils/revision.utils' ;
20+ import { createCommand } from '../../system/-webview/command' ;
1321import { pluralize } from '../../system/string' ;
1422import type { ViewsWithCommits } from '../viewBase' ;
1523import { CacheableChildrenViewNode } from './abstract/cacheableChildrenViewNode' ;
1624import type { ClipboardType , ViewNode } from './abstract/viewNode' ;
1725import { ContextValues , getViewNodeId } from './abstract/viewNode' ;
1826import { CodeSuggestionsNode } from './codeSuggestionsNode' ;
19- import { MessageNode } from './common' ;
27+ import { CommandMessageNode , MessageNode } from './common' ;
2028import { ResultsCommitsNode } from './resultsCommitsNode' ;
2129import { ResultsFilesNode } from './resultsFilesNode' ;
2230
@@ -159,6 +167,23 @@ export async function getPullRequestChildren(
159167
160168 const repoPath = repo . path ;
161169 const refs = getComparisonRefsForPullRequest ( repoPath , pullRequest . refs ! ) ;
170+ const identity = getRepositoryIdentityForPullRequest ( pullRequest ) ;
171+ if ( ! ( await ensurePullRequestRemote ( pullRequest , repo , { silent : true } ) ) ) {
172+ return [
173+ new CommandMessageNode (
174+ view ,
175+ parent ,
176+ createCommand < [ ViewNode , PullRequest , Repository ] > (
177+ 'gitlens.views.addPullRequestRemote' ,
178+ 'Add Pull Request Remote...' ,
179+ parent ,
180+ pullRequest ,
181+ repo ,
182+ ) ,
183+ `Missing remote '${ identity . provider . repoDomain } '. Click to add.` ,
184+ ) ,
185+ ] ;
186+ }
162187
163188 const counts = await ensurePullRequestRefs (
164189 pullRequest ,
0 commit comments