diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-12 06:31:16 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-12 09:22:36 -0700 |
commit | 4d06e8f7b520625d743816afbd9e0dc6945a25db (patch) | |
tree | fae81fef7d790e887c2ce38024af0d3822daaca9 /git-access.c | |
parent | 5e0c546beb48fd04758520bd3c6ff68bcc5b6d16 (diff) | |
download | subsurface-4d06e8f7b520625d743816afbd9e0dc6945a25db.tar.gz |
Cloud storage: check connection before connecting
libgit2 takes forever (a minute or so) to figure out that it can't connect
to a remote server.
So if we are using https as connection protocol, quickly check utilizing
RFCs 2324/7168 to make sure we can reach the cloud server (and not some
captive portal or something).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'git-access.c')
-rw-r--r-- | git-access.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/git-access.c b/git-access.c index 076bdbae7..8e1d95c28 100644 --- a/git-access.c +++ b/git-access.c @@ -217,6 +217,7 @@ static int check_remote_status(git_repository *repo, git_remote *origin, const c /* from qthelper.cpp */ extern bool getProxyString(char **proxy_string); +extern bool canReachCloudServer(); static git_repository *update_local_repo(const char *localdir, const char *remote, const char *branch) { @@ -259,6 +260,8 @@ static git_repository *update_local_repo(const char *localdir, const char *remot return repo; } + if (rt == HTTPS && !canReachCloudServer()) + return repo; #if USE_LIBGIT23_API git_fetch_options opts = GIT_FETCH_OPTIONS_INIT; if (rt == SSH) |