commands: avoid remote connections in checkout #5226
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.
Right now, creating a checkout object as used by the checkout and pull commands creates a manifest. This manifest in turn creates an SSHTransfer object to potentially connect via the new pure SSH protocol. However, connecting to the Internet during
git lfs checkoutis unexpected and may cause this operation to fail when one is not online.In order to set the manifest's configuration parameters correctly, we need to know whether it's possible to make a pure SSH protocol connection, so it's non-trivial to avoid this connection by delaying the initialization of SSHTransfer object. Instead, let's lazily create our manifest in the checkout code to avoid creating the connection. If we're performing a
git lfs pull, then it will be used and we'll initialize it very quickly, making the connection, and if we're usinggit lfs checkout, it won't be initialized at all, and we'll remain offline.Fixes #5191