summaryrefslogtreecommitdiffstats
path: root/git-access.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-26 12:19:17 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-26 12:28:47 -0400
commitaa76f74f9743d31238429d6d9cd1a2e897923971 (patch)
tree975a4005735e1b68758f6830d3db660f17f2b75e /git-access.c
parentc4eb9571bea061531667df467414e9a8cc31831f (diff)
downloadsubsurface-aa76f74f9743d31238429d6d9cd1a2e897923971.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'git-access.c')
-rw-r--r--git-access.c16
1 files changed, 13 insertions, 3 deletions
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;
}