Repository navigation
Reload HTTP fetch cache when cloning - #12308
Merged
Merged
Conversation
sergiou87
reviewed
May 28, 2021
sergiou87
left a comment
Member
There was a problem hiding this comment.
Fantastic 🕵️♀️ work!!! I love it 😍
Just one nit/question: why creating a new function instead of just adding the new parameter to the existing request?
I'm guessing that you didn't like having to pass 2 undefined values and then a true looks meh too… maybe a solution for the true could be renaming the parameter to cachePolicy and having an enum with two values: Default and Reload
What do you think?
sergiou87
approved these changes
May 28, 2021
sergiou87
pushed a commit
that referenced
this pull request
Jun 1, 2021
Reload HTTP fetch cache when cloning
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3855
Description
During cloning , we make an http request ending in
repos/${owner}/${name}(which is just getting the details of the repo).For example, If I clone my repo called
awesome-repo. It would bebaseurl/repos/tidy-dev/awesome-repo.By default, on this request:
The reason this probably stays "fresh" is because we use that same call many other places like when fetching.
Thus, if I have an already cloned repo of
awesome-repothat means I have a cache for it. If I change it's name tonot-so-awesome-repoand recreate a new repo calledawesome-repo. When desktop tries to clone it and hits that samebaseurl/repos/tidy-dev/awesome-repo, it gets the details or ID for the oldawesome-repowhich is now thenot-so-awesome-repo.Solution: Whenever we clone, we do not check the cache. This is intuitive anyways because cloning usually is our first contact with a repo and we wouldn't generally have a cache for it.
Notes on previous PRs that we thought might have fixed this.
There are two portions to this issue:
If I rename a repository
awesome-repotonot-so-awesome-repoon github.com, I want that rename reflected in Desktop. This is what Update the remote url if it changed. #8132 does - during a repository refresh cycle it detects the a change in the cloneURL when it is renamed and correctly updates the name of repository locally.More of a bug, if after I do step 1, I make a new repo called
awesome-repo(the old name) and clone it. I want it to be named and updateawesome-repobut it was named and updating tonot-so-awesome-repo. This may not have updated the name to'not-so-awesome-repowhen this issue was originally entered as I would expect the updated name only happens because of Update the remote url if it changed. #8132, however bug of it pointing tonot-so-awesome-repomay have still existed because the cache that made it so the id we retrieved for 'awesome-repo' was still now the id ofnot-so-awesome-repo.There is reference to this being closed by #9138 in this comment. Looking at the code.. I am not sure how this one did impact this.. but maybe there is more I don't understand. Only thing I suspect is that because step 1 changed the nature/timing/repro steps of this bug that it may have appeared to be gone.
Other thing to be aware of that I don't think we can mitigate without some kind of .com webhook to make the rename detection more immediate is if a user does 1 and 2 in quick succession not allowing desktop to detect the rename of the original repo. The cache will now be updated with 2's details and so the first instance of the repo in Desktop will now effectively be a duplicate of the new one in step two with the old name. If a user does this, the solution would be to just clone the renamed one.
Screenshots
This screen share shows the behavior off if I wait for the app to detect the rename (which takes a little bit as it is just waiting on a periodic cycle behind the scenes).
Screen.Recording.2021-05-27.at.1.23.34.PM.mov
This screen share highlights that is in fact pointing to and updating the new repo.
Screen.Recording.2021-05-27.at.2.07.02.PM.mov
Release notes
Notes: [Fixed] Rename a repo and then create and clone a repo with that repo's previous name now points to a new repo not the renamed one.