This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
[spike] Automatically detect the PR branch the user is on #2161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR associated with the current branch is only highlighted when the user created or opened the PR using GitHub for Visual Studio. This isn't very helpful for users who are new to the extension.
What this PR does
This spike attempts to look up the PR associated with the current branch if the branch hasn't already been tagged. It uses the simple approach of matching
refs/heads/<name>
references withrefs/pull/xxx/head
references. This approach has worked well for https://github.com/jcansdale/GitPullRequest.Challenges
There are issues with spam PRs, where an external user creates a PR from an existing branch in the target repository. For example, a user might create a PR from the
master
branch in a repository. The owner of the repository is likely to close the spam PR, but won't delete themaster
branch! Unfortunately the above approach can detect deleted branches but no closed PRs.Todo
Implement this using the GraphQL API so we can detect and ignore closed PRs.