Skip to content

Commit 27ebdeb

Browse files
authored
Failed to execute git thrown when attempting to view PR Description in "GitHub" tab (#5832) (#5852)
Fixes #5744
1 parent 6749f4d commit 27ebdeb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/github/folderRepositoryManager.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,13 +2174,13 @@ export class FolderRepositoryManager implements vscode.Disposable {
21742174
if (!pullRequestModel.head) {
21752175
return false;
21762176
}
2177-
const baseRemote = findLocalRepoRemoteFromGitHubRef(this.repository, pullRequestModel.base)?.name;
2178-
const headRemote = findLocalRepoRemoteFromGitHubRef(this.repository, pullRequestModel.head)?.name;
2179-
if (!baseRemote || !headRemote) {
2180-
return false;
2181-
}
2182-
const log = await this.repository.log({ range: `${headRemote}/${pullRequestModel.head.ref}..${baseRemote}/${pullRequestModel.base.ref}` });
2183-
return log.length === 0;
2177+
const repo = this._githubRepositories.find(
2178+
r => r.remote.owner === pullRequestModel.remote.owner && r.remote.repositoryName === pullRequestModel.remote.repositoryName,
2179+
);
2180+
const headBranch = `${pullRequestModel.head.owner}:${pullRequestModel.head.ref}`;
2181+
const baseBranch = `${pullRequestModel.base.owner}:${pullRequestModel.base.ref}`;
2182+
const log = await repo?.compareCommits(baseBranch, headBranch);
2183+
return log?.behind_by === 0;
21842184
}
21852185

21862186
async fetchById(githubRepo: GitHubRepository, id: number): Promise<PullRequestModel | undefined> {

0 commit comments

Comments
 (0)