Repository navigation
Open a pull request from a GitHub.com PR page in your fork in Desktop - #9138
Conversation
This reverts commit de751e2.
We can always implement that later if we deem it necessary
outofambit
left a comment
There was a problem hiding this comment.
left some initial thoughts. thanks @kuychaco!
|
|
||
| await Promise.all( | ||
| repositories.map(async repo => { | ||
| if (repo instanceof Repository) { |
There was a problem hiding this comment.
is this check necessary? i think the types should already be guaranteed to be Repository
Co-Authored-By: evelyn masso <[email protected]>
This reverts commit e92715d.
Co-Authored-By: evelyn masso <[email protected]>
@outofambit has experience of parallel git process spawning being an issue on Windows Co-Authored-By: evelyn masso <[email protected]>
Co-Authored-By: Josh Abernathy <[email protected]>
Co-Authored-By: Josh Abernathy <[email protected]>
|
I can't comment on the code specifically here, but I wanted to share a few thoughts on this. First, since this is triggered from the current link "open this in GitHub Desktop" on dotcom pull request pages, I think it's reasonably likely that it isn't currently used a ton since that link is in a weird place and not super discoverable or well understood. So while we're planning to ship this soon and it isn't likely to be used a ton right off the bat, we should think about it as something that we could hold up to people as something that will make it dramatically simpler to check out a PR locally from a PR page on dotcom, and it'll "just work" even if as many as 50% of GitHub users are using it every day. Also, I think given the aspiration to make this workflow much more seamless and widely available to GitHub users, we should ensure our implementation of this works well and is performant on macOS and Windows, and still works really well even if people use large repos and/or have a bunch of repos in Desktop (say, 100 or so). Hope that's helpful in thinking through it and testing, and obviously happy to chat if y'all have any questions or points of clarification. |
|
Thanks for all the great steps! Here are my test results: Only fork
Fork and upstream
Only upstream
No fork or upstream
Other
Notes
To Do:
|
|
thanks for the additional context @billygriffin! @kuychaco i think we need to revisit our conversation last week about performance, specifically around
at that scale, running a git command in almost all of the user's repos isn't tenable, even if done serially. unfortunately the caching we have for remotes in gitstore currently won't help either since i think the user is unlikely to have opened more than a handful of their repos. let's talk through alternative approaches more (whether we use the GitHubRepository database or find something else). |
|
Regarding #9138 (comment), @outofambit and I synced today and reworked the implementation so that instead of shelling out to git in order to get information for the remotes for each repository we are looking up remote information from the GitHubRepository database. The performance gains were massive! Looking up remote information with over 100 repos on my Windows VM consistently took less than 200 ms, whereas looking up information for just 5 repos via shelling out to git took around 3 seconds. A tradeoff we're making is the possibility of the remote info in the GitHubRepository database drifting out of sync with what's stored in Git and using stale info to determine which repository to open in Desktop. I'm investigating what situations this might be relevant in, and trying to understand just how/when the database gets populated and updated. Seeing as how remote information gets changed infrequently and that the consequences aren't super dire (the upstream repo might open in Desktop rather than a fork), I'm hoping that this tradeoff is easily worth making. /cc @billygriffin |
@billygriffin made the point that Desktop is already compromised in terms of remote urls drifting out of sync (see #3855). So we're not making things worse with this PR and feel good about shipping this implementation |
outofambit
left a comment
There was a problem hiding this comment.
hey @kuychaco this is looking good. great work on the performance for this, too.
would it be possible to pull the git-store remotes type change into a separate pull request? i don't think it relates to this new implementation and i'd like to review it a little more carefully outside of this. after that, i think we're ready to merge! 🚀
Co-Authored-By: evelyn masso <[email protected]>
Closes #9012
Description
This PR introduces behavior supportive of workflows where contributions are made from forks.
Previously, clicking the "open this in GitHub Desktop" link for a PR made from a fork on github.com would open the upstream repo, cloning if necessary. In order to make contributions locally from your fork, you would have to open your fork of the repo manually in the app.
With the changes introduced here, Desktop opens a user's fork repo when it makes sense to. We check the source of the PR, and if it is in Desktop (either as a fork or upstream) then we open the source repo and checkout the branch corresponding to the PR. If the source is not in Desktop, but the user has a fork in Desktop (ex: the source is another fork that doesn't belong to the user), we open the user's fork and checkout a branch corresponding to the PR. And in cases other than this we fallback to the current behavior of opening the upstream repo, cloning if needed.
/ cc @outofambit @billygriffin @tierninho
Behavior and test cases
Clone the following repos and open them in Desktop accordingly based on the setup instructions for each scenario:
Fork: https://github.com/kuychaco/urban-potato
Upstream: https://github.com/not-kuychaco/urban-potato
Note: start out each scenario with a repo focused in Desktop that has nothing to do with the fork or upstream being tested (to test that Desktop correctly switches to the correct repo).
Only fork in Desktop, no upstream:
Note: The fork opened in Desktop should be the PR source (ex: for not-kuychaco/urban-potato#2, https://github.com/kuychaco/urban-potato is the PR source so clone and open that fork in Desktop).
Before testing each of the following scenarios, make sure master branch is checked out in fork repo, and non-fork repo is the focused repo in Desktop (this tests that Desktop correctly switches to the fork repo, and correctly switches from the default branch to the source branch)
pr/#branch is checked out (Update readme.md not-kuychaco/urban-potato#5)Fork AND upstream in Desktop:
Note: before testing each of the following scenarios, make sure master branch is checked out in fork and upstream repos, and non-fork and non-upstream repo is the focused repo in Desktop (this tests that Desktop correctly switches to the fork repo, and correctly switches from the default branch to the source branch)
pr/#branch is checked out (Update readme.md not-kuychaco/urban-potato#5)Only upstream in Desktop, no forks:
Note: before testing each of the following scenarios, make sure master branch is checked out in upstream repo, and non-upstream repo is the focused repo in Desktop (this tests that Desktop correctly switches to the upstream repo, and correctly switches from the default branch to the source branch)
pr/#branch is checked out (Patch not-kuychaco/urban-potato#2)pr/#branch is checked out (Update readme.md not-kuychaco/urban-potato#5)No fork or upstream in Desktop:
Release notes
Notes: [Added] Open a pull request from a GitHub.com PR page in your fork in Desktop