-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use repository cache without update if offline #5819
Conversation
On macOS, we could use SCNetworkReachability to determine reachability after catching the error. |
8cfcacf
to
5769690
Compare
Updated this to a reasonable state, at least for macOS. Tested manually that we can reuse the cache if present and that we get the same error as today if not. |
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, couple of small suggestions
If there's an error populating the cache, check whether we're offline and have an existing valid repository state. If yes, use cached state and emit a warning. On macOS, we're using network reachability to determine the connection status, on other platforms we rely on crude parsing of the git error message for now.
5769690
to
3adb292
Compare
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me as well — I'm not familiar with the reachability APIs, but the logic looks correct as far as I can tell.
If there's an error populating the cache, check whether we're offline and have an existing valid repository state. If yes, use cached state and emit a warning.
On macOS, we're using network reachability to determine the connection status, on other platforms we rely on crude parsing of the git error message for now.