This repository was archived by the owner on Sep 11, 2020. It is now read-only.
remote: speed up pushes when the "remote" repo is local #1066
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.
As explained in #909, a valid use case for
Remote.PushContext()
is to set the storage field to something backed by a slow storage layer (i.e., a distributed file system), and push to a "remote" that's actually backed by a local git repo in the file system. The code currently gets the list of known advertised references from the remote, but then computes the entire set of ignored commits using the provided storage layer, which can be very slow.Instead, this PR introduces an optimization where, if the "remote" URL is actually local, the push code will construct a new filesystem-based storage layer for the URL and use it to construct the ignore list. This results in significant performance improvement in some cases.
When used with the Keybase git remote helper, this brought down the time to fetch/pull a single commit in an example repo with a large history from 3m48s to less than 5s.
This PR also moves around the URL-parsing code so that it's available in a more standard util library.
Issue: #909