Displaying a prompt when user clones repository that exists locally #59714
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.
Fixes #48490
This stores the
fetchUrl
, repository Location and last updated in the global store. If the amount in the store hits 50 it will empty the least recently updated repos.When cloning a repo it will look up the fetch url on the list in the global store and then check that the directory exists.
I started by using a map object using the fetchUrl as a key for fast lookup. This increased the amount of code needed to limit the amount to 50. I decided that for 50 records a map and an array wouldn't be too different in performance.
Let me know what you think of the approach.
I spent some time trying to write tests around this but i was finding it difficult to mock the
Repository
class fromgit.ts
. I was going to extract an interface and create a Mock implementation but as the area isn't well covered i decided i should talk to somebody on the team before going ahead with that.