This repository was archived by the owner on Sep 9, 2020. It is now read-only.
Guard against possibly stale local git repos #696
Merged
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 #639, fixes #699, fixes #649 (probably, so we'll gonna close it optimistically on merge).
In all these methods, I'd been relying on
sourceGateway.convertToRevision()
to update the local repo if the revision wasn't present in it. Problem is, it was checking whether the revision exists in the cache - which, for git, is populated from upstream directly, without necessarily updating the local. So, this adds retry logic that retries each of the version-acceptingsourceGateway
methods the assumption that what's insourceGateway.cache
is an accurate representation of what's on disk.However, this does highlight another problem with the generalized FSM
sourceGateway
uses for underlyingsource
state management. In this case,sourceGateway.cache
being out of sync with what's on disk is a byproduct of subtle, incorrect assumptions I made about the relationship betweensourceHasLatestLocally
andsourceHasLatestVersionList
.We eventually need to move to a system where the
source
becomes more elaborate, informing thesourceGateway
about the right FSM to use for its particular needs.No tests because this is very tricky to test without a whole apparatus - e.g., #533. TODOs instead 😄