Kaynağa Gözat

Avoids partial matches w/ associated GH branch PRs

main
Eric Amodio 1 yıl önce
ebeveyn
işleme
1dd59fcaac
2 değiştirilmiş dosya ile 30 ekleme ve 30 silme
  1. +2
    -1
      CHANGELOG.md
  2. +28
    -29
      src/plus/github/github.ts

+ 2
- 1
CHANGELOG.md Dosyayı Görüntüle

@ -44,8 +44,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixes [#2252](https://github.com/gitkraken/vscode-gitlens/issues/2252) - "Copy As"/"Copy Remote File Url" copies %23 instead of # in case of Gitea — thanks to [PR #2603](https://github.com/gitkraken/vscode-gitlens/pull/2603) by WofWca ([@WofWca](https://github.com/WofWca))
- Fixes [#2582](https://github.com/gitkraken/vscode-gitlens/issues/2582) - _Visual File History_ background color when in a panel
- Fixes [#2609](https://github.com/gitkraken/vscode-gitlens/issues/2609) - If you check out a branch that is hidden, GitLens should show the branch still
- Fixes tooltips sometimes failing to show in _Commit Graph_ rows when the Date column is hidden
- Fixes [#2595](https://github.com/gitkraken/vscode-gitlens/issues/2595) - Error when stashing changes
- Fixes tooltips sometimes failing to show in _Commit Graph_ rows when the Date column is hidden
- Fixes an issue with incorrectly showing associated pull requests with branches that are partial matches of the true branch the pull request is associated with
## [13.4.0] - 2023-03-16

+ 28
- 29
src/plus/github/github.ts Dosyayı Görüntüle

@ -554,13 +554,14 @@ export class GitHubApi implements Disposable {
interface QueryResult {
repository:
| {
refs: {
nodes: {
associatedPullRequests?: {
nodes?: GitHubPullRequest[];
};
}[];
};
ref:
| {
associatedPullRequests?: {
nodes?: GitHubPullRequest[];
};
}
| null
| undefined;
}
| null
| undefined;
@ -576,27 +577,25 @@ export class GitHubApi implements Disposable {
$avatarSize: Int
) {
repository(name: $repo, owner: $owner) {
refs(query: $branch, refPrefix: "refs/heads/", first: 1) {
nodes {
associatedPullRequests(first: $limit, orderBy: {field: UPDATED_AT, direction: DESC}, states: $include) {
nodes {
author {
ref(qualifiedName: $branch) {
associatedPullRequests(first: $limit, orderBy: {field: UPDATED_AT, direction: DESC}, states: $include) {
nodes {
author {
login
avatarUrl(size: $avatarSize)
url
}
permalink
number
title
state
updatedAt
closedAt
mergedAt
repository {
isFork
owner {
login
avatarUrl(size: $avatarSize)
url
}
permalink
number
title
state
updatedAt
closedAt
mergedAt
repository {
isFork
owner {
login
}
}
}
}
@ -613,7 +612,7 @@ export class GitHubApi implements Disposable {
...options,
owner: owner,
repo: repo,
branch: branch,
branch: `refs/heads/${branch}`,
// Since GitHub sort doesn't seem to really work, look for a max of 10 PRs and then sort them ourselves
limit: 10,
},
@ -621,7 +620,7 @@ export class GitHubApi implements Disposable {
);
// If the pr is not from a fork, keep it e.g. show root pr's on forks, otherwise, ensure the repo owners match
const prs = rsp?.repository?.refs.nodes[0]?.associatedPullRequests?.nodes?.filter(
const prs = rsp?.repository?.ref?.associatedPullRequests?.nodes?.filter(
pr => pr != null && (!pr.repository.isFork || pr.repository.owner.login === owner),
);
if (prs == null || prs.length === 0) return undefined;

Yükleniyor…
İptal
Kaydet