summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <vicent@github.com>2014-11-20 13:12:29 +0100
committerVicent Marti <vicent@github.com>2014-11-20 13:12:29 +0100
commit21361cb7feebdf4622f496a9717fe3af032cbe39 (patch)
treec92da241529dfd9a1a87770dab5492fe5167acf4
parentd7674b574384fcdb01495d4945d98e66d4a1cff0 (diff)
parent1ca61bdcb9f344f2005eade0e043789774367d29 (diff)
downloadlibgit2-21361cb7feebdf4622f496a9717fe3af032cbe39.tar.gz
Merge pull request #2719 from libgit2/cmn/fetch-twice
fetch: clear the connection data on close
-rw-r--r--src/transports/http.c1
-rw-r--r--tests/online/fetch.c11
2 files changed, 12 insertions, 0 deletions
diff --git a/src/transports/http.c b/src/transports/http.c
index 4070b683a..234ee229f 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -1009,6 +1009,7 @@ static int http_close(git_smart_subtransport *subtransport)
git_vector_clear(&t->auth_contexts);
gitno_connection_data_free_ptrs(&t->connection_data);
+ memset(&t->connection_data, 0x0, sizeof(gitno_connection_data));
return 0;
}
diff --git a/tests/online/fetch.c b/tests/online/fetch.c
index ec16dd2fd..848b87410 100644
--- a/tests/online/fetch.c
+++ b/tests/online/fetch.c
@@ -202,3 +202,14 @@ void test_online_fetch__remote_symrefs(void)
git_remote_free(remote);
}
+
+void test_online_fetch__twice(void)
+{
+ git_remote *remote;
+
+ cl_git_pass(git_remote_create(&remote, _repo, "test", "http://github.com/libgit2/TestGitRepository.git"));
+ cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
+ cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
+
+ git_remote_free(remote);
+}