Skip to content

fix(reviewManager): use pr.base.ref instead of pr.base.name in hasBranch call#8698

Merged
alexr00 merged 2 commits intomicrosoft:mainfrom
Will-hxw:fix/8668-hasbranch-base-ref
Apr 24, 2026
Merged

fix(reviewManager): use pr.base.ref instead of pr.base.name in hasBranch call#8698
alexr00 merged 2 commits intomicrosoft:mainfrom
Will-hxw:fix/8668-hasbranch-base-ref

Conversation

@Will-hxw
Copy link
Copy Markdown
Contributor

Summary

  • Fix hasBranch() call to use pr.base.ref (branch name) instead of pr.base.name (repository name)

Why

In resolvePullRequest(), the check hasBranch(pr.base.name) was passing the repository name instead of the branch name:

  • pr.base.ref = branch name (e.g., "main")
  • pr.base.name = repository name (e.g., "vscode-pull-request-github")

This caused hasBranch() to query refs/heads/<repo-name> which never matches an actual branch, making the validation always fail.

Validation

  • Single line change, no test modification needed
  • Logic review: pr.base.ref is the correct property for branch name lookup

Related

Fixes #8668

…nch call

pr.base.ref is the branch name (e.g., "main") while
pr.base.name is the repository name. hasBranch() expects a branch
name, so passing pr.base.name would always query refs/heads/<repo-name>
which never matches an actual branch.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@alexr00 alexr00 added this to the 1.118.0 milestone Apr 23, 2026
@alexr00 alexr00 enabled auto-merge (squash) April 23, 2026 14:53
@alexr00
Copy link
Copy Markdown
Member

alexr00 commented Apr 23, 2026

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@alexr00 alexr00 closed this Apr 23, 2026
auto-merge was automatically disabled April 23, 2026 15:48

Pull request was closed

@alexr00 alexr00 reopened this Apr 23, 2026
@alexr00 alexr00 enabled auto-merge (squash) April 23, 2026 15:49
@alexr00
Copy link
Copy Markdown
Member

alexr00 commented Apr 24, 2026

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@alexr00 alexr00 merged commit 61fe37b into microsoft:main Apr 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hasBranch called with repository name (pr.base.name) instead of branch name (pr.base.ref) in reviewManager.ts

3 participants