Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[spike] Automatically detect the PR branch the user is on #2161
Conversation
This implementation uses ListReferences rather than a GitHub API.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


jcansdale commentedJan 8, 2019
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/headreferences. 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
masterbranch in a repository. The owner of the repository is likely to close the spam PR, but won't delete themasterbranch! 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.