Repository navigation
Unify logic to checkout a pull request - #9382
Conversation
| for (const repository of repositories) { | ||
| if (this.doesRepositoryMatchUrl(repository, headUrl)) { | ||
| return repository | ||
| } | ||
| } |
There was a problem hiding this comment.
I wanted to use repositories.find() here but TypeScript's Array.prototype.find is not capable to infer that the found element can only be of type Repository | null.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Ran through almost all the tests here #9138 (comment) and only one stood out -- the rest passed.
To set up:
Expected: branch opens in forked repo |
Thanks! ✨✨ I fixed the issue in the last commit. This was caused because the URL that's opened in that case is |
c04d94e to
b964a3b
Compare
8935495 to
88ac1b6
Compare
88ac1b6 to
1bb472c
Compare
niik
left a comment
There was a problem hiding this comment.
Noticed I had typed up some review notes weeks ago so I figured I might as well merge and drop these in. Note that this is a pretty superficial initial review
Co-authored-by: Markus Olsson <[email protected]>
Co-authored-by: Markus Olsson <[email protected]>
Co-Authored-By: Markus Olsson <[email protected]>
This comment has been minimized.
This comment has been minimized.
|
Hey, I was looking to test some of the scenarios here, but is there a merge conflict that needs resolving? |
@tierninho I think this is because @rafeca force-pushed the branch at one point Unfortunately for you it means it's gonna be a bit trickier to get up to date. Either you delete the branch locally and check it out again or you can run the following command in your terminal
|
Ups, sorry about that @tierninho ! and thanks @niik for figuring it out! |
niik
left a comment
There was a problem hiding this comment.
Hey @rafeca, this is starting to look really good. Thanks so much for biting the bullet and cleaning this up. I've got a few purely stylistic suggestions below and then some changes that I've made as I've been reviewing that I intend to open as a separate PR once this has merged so that we can review them on their own.
Co-authored-by: Markus Olsson <[email protected]>

Closes #9439
Closes #9593
This PR is based off #9340
Description
This PR contains a small refactor to unify the logic to checkout a PR from GitHub.
Currently, there are two ways to checkout a PR:
Each of these entry points has its own logic, which causes some inconsistencies between them (as we found in #9340 (comment)).
Test cases
I've tried to follow the test cases that were written in #9138, but couldn't check every single one of them.
Release notes
Notes: no-notes