Skip to content

Update the remote url if it changed. - #8132

Merged
outofambit merged 34 commits into
developmentfrom
bugfix/update-origin-url
Mar 12, 2020
Merged

outofambit merged 34 commits into
developmentfrom
bugfix/update-origin-url

Conversation

@probablycorey

@probablycorey probablycorey commented Aug 19, 2019 •

Copy link
Copy Markdown
Contributor

Overview

Closes part of #3855
Closes #8590 (verify that this is true before merging)

Description

The steps to reproduce this bug are found at #3855 (comment).

The tl;dr is – if you rename a repository on github.com the remote url isn’t updated in the .gitconfig. This isn’t a problem until you create new repo that has the original name and the remote urls are in conflict.

My attempt to fix this involves detecting when the repository is renamed (in AppStore.repositoryWithRefreshedGitHubRepository) and updating the remote url in .gitconfig (via gitStore.setRemoteURL).

Special notes

  • If the current remote url uses a protocol other than ssh we don’t update the remote url. I did this based on what Markus said in Update the remote url if it changed. #8132 (comment). The assumption being, if the user has specified a protocol other than Desktop’s default protocol then we should trust that they know what the remote url should be.
  • If the gitStore.defaultRemote.url is the different than
    repository.gitHubRepository.cloneURL we don’t update the remote url. Like above, this means the user has manually changed the remote url at some point so we trust that they know what the url should be and how to updated it.
  • @outofambit suggested calling gitStore.loadRemotes() after the remote is set. But I tried to verify that this was a problem in my tests and couldn’t.

Release notes

  • Fixes bug caused by changing repository names via github.com

cc @kuychaco

Comment thread app/src/lib/stores/app-store.ts Resolved
@probablycorey
probablycorey marked this pull request as ready for review September 4, 2019 21:48
@probablycorey
probablycorey requested a review from niik September 9, 2019 16:14
niik
niik previously requested changes Sep 18, 2019

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @probablycorey, super sorry for the wait here. I've provided a few initial thoughts. I apologize for this dragging out for so long but this type of change scares the living daylights outta me and I want to be confident we don't ship something which ends up breaking people's ability to push or fetch because of something we've overlooked.

I'm absolutely onboard with the general approach here, it's just that I want to be confident that we've done our best to consider the inevitable edge cases too.

@niik niik self-assigned this Sep 18, 2019
Loongkee
Loongkee previously approved these changes Nov 5, 2019

@berty2007 berty2007 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hoffe es geht

kuychaco and others added 3 commits March 6, 2020 15:26
Co-Authored-By: evelyn masso <[email protected]>
Co-Authored-By: evelyn masso <[email protected]>
Co-Authored-By: evelyn masso <[email protected]>
@kuychaco kuychaco self-assigned this Mar 6, 2020
@kuychaco
kuychaco requested a review from outofambit March 6, 2020 23:46
@kuychaco

kuychaco commented Mar 7, 2020 •

Copy link
Copy Markdown
Contributor

@tierninho this should be ready enough for QA testing! Please follow steps at #3855 (comment) as well as #3855 🙏

I just tested #3855 (comment) on Mac and things looked good. Worth noting is that it took a while for the repo name change to show up in Desktop (I'm gonna guess like 10 seconds or so). So if you don't see the update immediately try again in a bit.

outofambit
outofambit previously approved these changes Mar 11, 2020

@outofambit outofambit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good! left a couple small suggestions, but nothing blocking. excited to see this on beta!

@outofambit
outofambit dismissed niik’s stale review March 11, 2020 17:53

feedback incorporated

@tierninho

Copy link
Copy Markdown
Contributor

Confirming all looks good in OSX. Currently blocked on Windows testing for the time being. Will circle back in due time.

outofambit
outofambit previously approved these changes Mar 12, 2020
@outofambit outofambit assigned outofambit and unassigned kuychaco Mar 12, 2020
@tierninho
tierninho self-requested a review March 12, 2020 18:49
tierninho
tierninho previously approved these changes Mar 12, 2020

@tierninho tierninho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirming all looks good on Windows 10. In all OS, there is a slight delay in getting Desktop to update the new repo name, but from past experience, this can be expected. If there are any edge cases with forks that need to be explored, please share. As expected, the initial tests showed the origins updating and the upstream still intact.

@outofambit
outofambit dismissed stale reviews from tierninho and themself via e4bd4e3 March 12, 2020 19:46
@outofambit
outofambit merged commit 7553dba into development Mar 12, 2020
@outofambit
outofambit deleted the bugfix/update-origin-url branch March 12, 2020 20:12
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.

Alert Desktop when Repository has been renamed

7 participants