From aa76f74f9743d31238429d6d9cd1a2e897923971 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 26 Sep 2015 12:19:17 -0400 Subject: Cloud storage: delete http.proxy key if no proxy is set Apparently Windows doesn't like it if the proxy string is set to the empty string. Also give some better debugging output when run in verbose mode. Signed-off-by: Dirk Hohndel --- git-access.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'git-access.c') diff --git a/git-access.c b/git-access.c index 6d14868b9..d78aa0629 100644 --- a/git-access.c +++ b/git-access.c @@ -507,10 +507,14 @@ int sync_with_remote(git_repository *repo, const char *remote, const char *branc git_repository_config(&conf, repo); if (rt == RT_HTTPS && getProxyString(&proxy_string)) { + if (verbose) + fprintf(stderr, "set proxy to \"%s\"\n", proxy_string); git_config_set_string(conf, "http.proxy", proxy_string); free(proxy_string); } else { - git_config_set_string(conf, "http.proxy", ""); + if (verbose) + fprintf(stderr, "delete proxy setting\n"); + git_config_delete_entry(conf, "http.proxy"); } /* @@ -550,7 +554,7 @@ int sync_with_remote(git_repository *repo, const char *remote, const char *branc else report_error("Unable to fetch remote '%s'", remote); if (verbose) - fprintf(stderr, "remote fetched failed (%s)\n", giterr_last()->message); + fprintf(stderr, "remote fetch failed (%s)\n", giterr_last()->message); error = 0; } else { error = check_remote_status(repo, origin, remote, branch, rt); @@ -586,10 +590,16 @@ static int repository_create_cb(git_repository **out, const char *path, int bare int ret = git_repository_init(out, path, bare); + git_repository_config(&conf, *out); if (getProxyString(&proxy_string)) { - git_repository_config(&conf, *out); + if (verbose) + fprintf(stderr, "set proxy to \"%s\"\n", proxy_string); git_config_set_string(conf, "http.proxy", proxy_string); free(proxy_string); + } else { + if (verbose) + fprintf(stderr, "delete proxy setting\n"); + git_config_delete_entry(conf, "http.proxy"); } return ret; } -- cgit v1.2.3-70-g09d2