summaryrefslogtreecommitdiff
path: root/tests/network
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-04-21 22:10:36 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-13 09:46:35 +0200
commit8f0104ecc54db00a075310ab744a19eb60e3d740 (patch)
tree775b3237a853c556a4d44840fc6c562e7b114415 /tests/network
parent05259114427234831cf4915cbe40a5bb8ea021b0 (diff)
downloadlibgit2-8f0104ecc54db00a075310ab744a19eb60e3d740.tar.gz
Remove the callbacks struct from the remote
Having the setting be different from calling its actions was not a great idea and made for the sake of the wrong convenience. Instead of that, accept either fetch options, push options or the callbacks when dealing with the remote. The fetch options are currently only the callbacks, but more options will be moved from setters and getters on the remote to the options. This does mean passing the same struct along the different functions but the typical use-case will only call git_remote_fetch() or git_remote_push() and so won't notice much difference.
Diffstat (limited to 'tests/network')
-rw-r--r--tests/network/fetchlocal.c117
-rw-r--r--tests/network/remote/defaultbranch.c6
-rw-r--r--tests/network/remote/local.c47
-rw-r--r--tests/network/remote/remotes.c10
4 files changed, 72 insertions, 108 deletions
diff --git a/tests/network/fetchlocal.c b/tests/network/fetchlocal.c
index 13b3cf07c..a191b7b6b 100644
--- a/tests/network/fetchlocal.c
+++ b/tests/network/fetchlocal.c
@@ -34,19 +34,16 @@ void test_network_fetchlocal__complete(void)
git_strarray refnames = {0};
const char *url = cl_git_fixture_url("testrepo.git");
- git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+ git_fetch_options options = GIT_FETCH_OPTIONS_INIT;
- callbacks.transfer_progress = transfer_cb;
- callbacks.payload = &callcount;
+ options.callbacks.transfer_progress = transfer_cb;
+ options.callbacks.payload = &callcount;
cl_set_cleanup(&cleanup_local_repo, "foo");
cl_git_pass(git_repository_init(&repo, "foo", true));
cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH));
- cl_git_pass(git_remote_download(origin, NULL));
- cl_git_pass(git_remote_update_tips(origin, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(19, (int)refnames.count);
@@ -66,17 +63,16 @@ void test_network_fetchlocal__prune(void)
git_reference *ref;
git_repository *remote_repo = cl_git_sandbox_init("testrepo.git");
const char *url = cl_git_path_url(git_repository_path(remote_repo));
- git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+ git_fetch_options options = GIT_FETCH_OPTIONS_INIT;
- callbacks.transfer_progress = transfer_cb;
- callbacks.payload = &callcount;
+ options.callbacks.transfer_progress = transfer_cb;
+ options.callbacks.payload = &callcount;
cl_set_cleanup(&cleanup_local_repo, "foo");
cl_git_pass(git_repository_init(&repo, "foo", true));
cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_fetch(origin, NULL, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(19, (int)refnames.count);
@@ -89,11 +85,8 @@ void test_network_fetchlocal__prune(void)
git_reference_free(ref);
cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH));
- cl_git_pass(git_remote_download(origin, NULL));
- cl_git_pass(git_remote_prune(origin));
- cl_git_pass(git_remote_update_tips(origin, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
+ cl_git_pass(git_remote_prune(origin, &options.callbacks));
cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(18, (int)refnames.count);
@@ -105,11 +98,8 @@ void test_network_fetchlocal__prune(void)
git_reference_free(ref);
cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH));
- cl_git_pass(git_remote_download(origin, NULL));
- cl_git_pass(git_remote_prune(origin));
- cl_git_pass(git_remote_update_tips(origin, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
+ cl_git_pass(git_remote_prune(origin, &options.callbacks));
cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(17, (int)refnames.count);
@@ -151,9 +141,9 @@ void test_network_fetchlocal__prune_overlapping(void)
git_repository *remote_repo = cl_git_sandbox_init("testrepo.git");
const char *url = cl_git_path_url(git_repository_path(remote_repo));
- git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
- callbacks.transfer_progress = transfer_cb;
- callbacks.payload = &callcount;
+ git_fetch_options options = GIT_FETCH_OPTIONS_INIT;
+ options.callbacks.transfer_progress = transfer_cb;
+ options.callbacks.payload = &callcount;
cl_git_pass(git_reference_lookup(&ref, remote_repo, "refs/heads/master"));
git_oid_cpy(&target, git_reference_target(ref));
@@ -165,7 +155,6 @@ void test_network_fetchlocal__prune_overlapping(void)
cl_git_pass(git_repository_init(&repo, "foo", true));
cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url));
- git_remote_set_callbacks(origin, &callbacks);
cl_git_pass(git_repository_config(&config, repo));
cl_git_pass(git_config_set_bool(config, "remote.origin.prune", true));
@@ -173,8 +162,7 @@ void test_network_fetchlocal__prune_overlapping(void)
git_remote_free(origin);
cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_fetch(origin, NULL, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
assert_ref_exists(repo, "refs/remotes/origin/master");
assert_ref_exists(repo, "refs/remotes/origin/pr/42");
@@ -188,9 +176,8 @@ void test_network_fetchlocal__prune_overlapping(void)
git_remote_free(origin);
cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
- callbacks.update_tips = update_tips_fail_on_call;
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_fetch(origin, NULL, NULL));
+ options.callbacks.update_tips = update_tips_fail_on_call;
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
assert_ref_exists(repo, "refs/remotes/origin/master");
assert_ref_exists(repo, "refs/remotes/origin/pr/42");
@@ -204,9 +191,8 @@ void test_network_fetchlocal__prune_overlapping(void)
git_remote_free(origin);
cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
- callbacks.update_tips = update_tips_fail_on_call;
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_fetch(origin, NULL, NULL));
+ options.callbacks.update_tips = update_tips_fail_on_call;
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
git_config_free(config);
git_strarray_free(&refnames);
@@ -224,17 +210,16 @@ void test_network_fetchlocal__fetchprune(void)
git_config *config;
git_repository *remote_repo = cl_git_sandbox_init("testrepo.git");
const char *url = cl_git_path_url(git_repository_path(remote_repo));
- git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+ git_fetch_options options = GIT_FETCH_OPTIONS_INIT;
- callbacks.transfer_progress = transfer_cb;
- callbacks.payload = &callcount;
+ options.callbacks.transfer_progress = transfer_cb;
+ options.callbacks.payload = &callcount;
cl_set_cleanup(&cleanup_local_repo, "foo");
cl_git_pass(git_repository_init(&repo, "foo", true));
cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_fetch(origin, NULL, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(19, (int)refnames.count);
@@ -247,9 +232,8 @@ void test_network_fetchlocal__fetchprune(void)
git_reference_free(ref);
cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_fetch(origin, NULL, NULL));
- cl_git_pass(git_remote_prune(origin));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
+ cl_git_pass(git_remote_prune(origin, &options.callbacks));
cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(18, (int)refnames.count);
@@ -265,8 +249,7 @@ void test_network_fetchlocal__fetchprune(void)
git_config_free(config);
cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
cl_assert_equal_i(1, git_remote_prune_refs(origin));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_fetch(origin, NULL, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(17, (int)refnames.count);
@@ -289,17 +272,16 @@ void test_network_fetchlocal__prune_tag(void)
git_repository *remote_repo = cl_git_sandbox_init("testrepo.git");
const char *url = cl_git_path_url(git_repository_path(remote_repo));
- git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+ git_fetch_options options = GIT_FETCH_OPTIONS_INIT;
- callbacks.transfer_progress = transfer_cb;
- callbacks.payload = &callcount;
+ options.callbacks.transfer_progress = transfer_cb;
+ options.callbacks.payload = &callcount;
cl_set_cleanup(&cleanup_local_repo, "foo");
cl_git_pass(git_repository_init(&repo, "foo", true));
cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_fetch(origin, NULL, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
git_remote_free(origin);
cl_git_pass(git_revparse_single(&obj, repo, "origin/master"));
@@ -321,8 +303,7 @@ void test_network_fetchlocal__prune_tag(void)
git_config_free(config);
cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
cl_assert_equal_i(1, git_remote_prune_refs(origin));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_fetch(origin, NULL, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
assert_ref_exists(repo, "refs/tags/some-tag");
cl_git_fail_with(GIT_ENOTFOUND, git_reference_lookup(&ref, repo, "refs/remotes/origin/fake-remote"));
@@ -346,10 +327,10 @@ void test_network_fetchlocal__partial(void)
int callcount = 0;
git_strarray refnames = {0};
const char *url;
- git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+ git_fetch_options options = GIT_FETCH_OPTIONS_INIT;
- callbacks.transfer_progress = transfer_cb;
- callbacks.payload = &callcount;
+ options.callbacks.transfer_progress = transfer_cb;
+ options.callbacks.payload = &callcount;
cl_set_cleanup(&cleanup_sandbox, NULL);
cl_git_pass(git_reference_list(&refnames, repo));
@@ -357,10 +338,7 @@ void test_network_fetchlocal__partial(void)
url = cl_git_fixture_url("testrepo.git");
cl_git_pass(git_remote_create(&origin, repo, GIT_REMOTE_ORIGIN, url));
- git_remote_set_callbacks(origin, &callbacks);
- cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH));
- cl_git_pass(git_remote_download(origin, NULL));
- cl_git_pass(git_remote_update_tips(origin, NULL));
+ cl_git_pass(git_remote_fetch(origin, NULL, &options, NULL));
git_strarray_free(&refnames);
@@ -418,16 +396,13 @@ void test_network_fetchlocal__multi_remotes(void)
git_repository *repo = cl_git_sandbox_init("testrepo.git");
git_remote *test, *test2;
git_strarray refnames = {0};
- git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+ git_fetch_options options = GIT_FETCH_OPTIONS_INIT;
cl_set_cleanup(&cleanup_sandbox, NULL);
- callbacks.transfer_progress = transfer_cb;
+ options.callbacks.transfer_progress = transfer_cb;
cl_git_pass(git_remote_lookup(&test, repo, "test"));
cl_git_pass(git_remote_set_url(test, cl_git_fixture_url("testrepo.git")));
- git_remote_set_callbacks(test, &callbacks);
- cl_git_pass(git_remote_connect(test, GIT_DIRECTION_FETCH));
- cl_git_pass(git_remote_download(test, NULL));
- cl_git_pass(git_remote_update_tips(test, NULL));
+ cl_git_pass(git_remote_fetch(test, NULL, &options, NULL));
cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(32, (int)refnames.count);
@@ -435,10 +410,7 @@ void test_network_fetchlocal__multi_remotes(void)
cl_git_pass(git_remote_lookup(&test2, repo, "test_with_pushurl"));
cl_git_pass(git_remote_set_url(test2, cl_git_fixture_url("testrepo.git")));
- git_remote_set_callbacks(test2, &callbacks);
- cl_git_pass(git_remote_connect(test2, GIT_DIRECTION_FETCH));
- cl_git_pass(git_remote_download(test2, NULL));
- cl_git_pass(git_remote_update_tips(test2, NULL));
+ cl_git_pass(git_remote_fetch(test2, NULL, &options, NULL));
cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(44, (int)refnames.count);
@@ -463,7 +435,7 @@ void test_network_fetchlocal__call_progress(void)
{
git_repository *repo;
git_remote *remote;
- git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+ git_fetch_options options = GIT_FETCH_OPTIONS_INIT;
int callcount = 0;
cl_git_pass(git_repository_init(&repo, "foo.git", true));
@@ -471,11 +443,10 @@ void test_network_fetchlocal__call_progress(void)
cl_git_pass(git_remote_create_with_fetchspec(&remote, repo, "origin", cl_git_fixture_url("testrepo.git"), "+refs/heads/*:refs/heads/*"));
- callbacks.sideband_progress = sideband_cb;
- callbacks.payload = &callcount;
- cl_git_pass(git_remote_set_callbacks(remote, &callbacks));
+ options.callbacks.sideband_progress = sideband_cb;
+ options.callbacks.payload = &callcount;
- cl_git_pass(git_remote_fetch(remote, NULL, NULL));
+ cl_git_pass(git_remote_fetch(remote, NULL, &options, NULL));
cl_assert(callcount != 0);
git_remote_free(remote);
diff --git a/tests/network/remote/defaultbranch.c b/tests/network/remote/defaultbranch.c
index c83d5c8b0..e83755ef6 100644
--- a/tests/network/remote/defaultbranch.c
+++ b/tests/network/remote/defaultbranch.c
@@ -26,7 +26,7 @@ static void assert_default_branch(const char *should)
{
git_buf name = GIT_BUF_INIT;
- cl_git_pass(git_remote_connect(g_remote, GIT_DIRECTION_FETCH));
+ cl_git_pass(git_remote_connect(g_remote, GIT_DIRECTION_FETCH, NULL));
cl_git_pass(git_remote_default_branch(&name, g_remote));
cl_assert_equal_s(should, name.ptr);
git_buf_free(&name);
@@ -57,7 +57,7 @@ void test_network_remote_defaultbranch__no_default_branch(void)
git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_remote_create(&remote_b, g_repo_b, "self", git_repository_path(g_repo_b)));
- cl_git_pass(git_remote_connect(remote_b, GIT_DIRECTION_FETCH));
+ cl_git_pass(git_remote_connect(remote_b, GIT_DIRECTION_FETCH, NULL));
cl_git_pass(git_remote_ls(&heads, &len, remote_b));
cl_assert_equal_i(0, len);
@@ -80,7 +80,7 @@ void test_network_remote_defaultbranch__detached_sharing_nonbranch_id(void)
cl_git_pass(git_reference_create(&ref, g_repo_a, "refs/foo/bar", &id, 1, NULL));
git_reference_free(ref);
- cl_git_pass(git_remote_connect(g_remote, GIT_DIRECTION_FETCH));
+ cl_git_pass(git_remote_connect(g_remote, GIT_DIRECTION_FETCH, NULL));
cl_git_fail_with(GIT_ENOTFOUND, git_remote_default_branch(&buf, g_remote));
cl_git_pass(git_clone(&cloned_repo, git_repository_path(g_repo_a), "./local-detached", NULL));
diff --git a/tests/network/remote/local.c b/tests/network/remote/local.c
index ba54de6af..1e03371f0 100644
--- a/tests/network/remote/local.c
+++ b/tests/network/remote/local.c
@@ -40,7 +40,7 @@ static void connect_to_local_repository(const char *local_repository)
git_buf_sets(&file_path_buf, cl_git_path_url(local_repository));
cl_git_pass(git_remote_create_anonymous(&remote, repo, git_buf_cstr(&file_path_buf), NULL));
- cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH));
+ cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH, NULL));
}
void test_network_remote_local__connected(void)
@@ -138,8 +138,7 @@ void test_network_remote_local__shorthand_fetch_refspec0(void)
connect_to_local_repository(cl_fixture("testrepo.git"));
- cl_git_pass(git_remote_download(remote, &array));
- cl_git_pass(git_remote_update_tips(remote, NULL));
+ cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL));
cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master"));
git_reference_free(ref);
@@ -164,8 +163,7 @@ void test_network_remote_local__shorthand_fetch_refspec1(void)
connect_to_local_repository(cl_fixture("testrepo.git"));
git_remote_clear_refspecs(remote);
- cl_git_pass(git_remote_download(remote, &array));
- cl_git_pass(git_remote_update_tips(remote, NULL));
+ cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL));
cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master"));
@@ -178,7 +176,7 @@ void test_network_remote_local__tagopt(void)
cl_git_pass(git_remote_create(&remote, repo, "tagopt", cl_git_path_url(cl_fixture("testrepo.git"))));
git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_ALL);
- cl_git_pass(git_remote_fetch(remote, NULL, NULL));
+ cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/tagopt/master"));
git_reference_free(ref);
@@ -186,7 +184,7 @@ void test_network_remote_local__tagopt(void)
git_reference_free(ref);
git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_AUTO);
- cl_git_pass(git_remote_fetch(remote, NULL, NULL));
+ cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/tagopt/master"));
git_reference_free(ref);
}
@@ -206,9 +204,7 @@ void test_network_remote_local__push_to_bare_remote(void)
/* Get some commits */
connect_to_local_repository(cl_fixture("testrepo.git"));
- cl_git_pass(git_remote_download(remote, &array));
- cl_git_pass(git_remote_update_tips(remote, NULL));
- git_remote_disconnect(remote);
+ cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL));
/* Set up an empty bare repo to push into */
{
@@ -219,7 +215,7 @@ void test_network_remote_local__push_to_bare_remote(void)
/* Connect to the bare repo */
cl_git_pass(git_remote_create_anonymous(&localremote, repo, "./localbare.git", NULL));
- cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH));
+ cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH, NULL));
/* Try to push */
cl_git_pass(git_remote_upload(remote, &push_array, NULL));
@@ -244,8 +240,8 @@ void test_network_remote_local__push_to_bare_remote_with_file_url(void)
/* Get some commits */
connect_to_local_repository(cl_fixture("testrepo.git"));
- cl_git_pass(git_remote_download(remote, &array));
- cl_git_pass(git_remote_update_tips(remote, NULL));
+ cl_git_pass(git_remote_download(remote, &array, NULL));
+ cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
git_remote_disconnect(remote);
/* Set up an empty bare repo to push into */
@@ -260,7 +256,7 @@ void test_network_remote_local__push_to_bare_remote_with_file_url(void)
/* Connect to the bare repo */
cl_git_pass(git_remote_create_anonymous(&localremote, repo, url, NULL));
- cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH));
+ cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH, NULL));
/* Try to push */
cl_git_pass(git_remote_upload(remote, &push_array, NULL));
@@ -285,8 +281,8 @@ void test_network_remote_local__push_to_non_bare_remote(void)
/* Get some commits */
connect_to_local_repository(cl_fixture("testrepo.git"));
- cl_git_pass(git_remote_download(remote, &array));
- cl_git_pass(git_remote_update_tips(remote, NULL));
+ cl_git_pass(git_remote_download(remote, &array, NULL));
+ cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
git_remote_disconnect(remote);
/* Set up an empty non-bare repo to push into */
@@ -298,7 +294,7 @@ void test_network_remote_local__push_to_non_bare_remote(void)
/* Connect to the bare repo */
cl_git_pass(git_remote_create_anonymous(&localremote, repo, "./localnonbare", NULL));
- cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH));
+ cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH, NULL));
/* Try to push */
cl_git_fail_with(GIT_EBAREREPO, git_remote_upload(localremote, &push_array, NULL));
@@ -324,7 +320,7 @@ void test_network_remote_local__fetch(void)
connect_to_local_repository(cl_fixture("testrepo.git"));
- cl_git_pass(git_remote_fetch(remote, &array, "UPDAAAAAATE!!"));
+ cl_git_pass(git_remote_fetch(remote, &array, NULL, "UPDAAAAAATE!!"));
cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master"));
git_reference_free(ref);
@@ -353,8 +349,8 @@ void test_network_remote_local__reflog(void)
connect_to_local_repository(cl_fixture("testrepo.git"));
- cl_git_pass(git_remote_download(remote, &array));
- cl_git_pass(git_remote_update_tips(remote, "UPDAAAAAATE!!"));
+ cl_git_pass(git_remote_download(remote, &array, NULL));
+ cl_git_pass(git_remote_update_tips(remote, NULL, "UPDAAAAAATE!!"));
cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master"));
cl_assert_equal_i(1, git_reflog_entrycount(log));
@@ -381,7 +377,7 @@ void test_network_remote_local__fetch_default_reflog_message(void)
connect_to_local_repository(cl_fixture("testrepo.git"));
- cl_git_pass(git_remote_fetch(remote, &array, NULL));
+ cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL));
cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master"));
cl_assert_equal_i(1, git_reflog_entrycount(log));
@@ -408,7 +404,7 @@ void test_network_remote_local__opportunistic_update(void)
/* this remote has a passive refspec of "refs/heads/<star>:refs/remotes/origin/<star>" */
cl_git_pass(git_remote_create(&remote, repo, "origin", cl_git_fixture_url("testrepo.git")));
/* and we pass the active refspec "master" */
- cl_git_pass(git_remote_fetch(remote, &array, NULL));
+ cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL));
/* and we expect that to update our copy of origin's master */
cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/origin/master"));
@@ -430,11 +426,8 @@ void test_network_remote_local__update_tips_for_new_remote(void) {
/* Push to bare repo */
cl_git_pass(git_remote_create(&new_remote, src_repo, "bare", "./localbare.git"));
- cl_git_pass(git_remote_connect(new_remote, GIT_DIRECTION_PUSH));
- cl_git_pass(git_remote_upload(new_remote, &push_array, NULL));
-
- /* Update tips and make sure remote branch has been created */
- cl_git_pass(git_remote_update_tips(new_remote, NULL));
+ cl_git_pass(git_remote_push(new_remote, &push_array, NULL));
+ /* Make sure remote branch has been created */
cl_git_pass(git_branch_lookup(&branch, src_repo, "bare/master", GIT_BRANCH_REMOTE));
git_reference_free(branch);
diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c
index 3e6e438cc..456fb39fe 100644
--- a/tests/network/remote/remotes.c
+++ b/tests/network/remote/remotes.c
@@ -86,7 +86,7 @@ void test_network_remote_remotes__error_when_no_push_available(void)
cl_git_pass(git_remote_set_transport(r, git_transport_local, NULL));
- cl_git_pass(git_remote_connect(r, GIT_DIRECTION_PUSH));
+ cl_git_pass(git_remote_connect(r, GIT_DIRECTION_PUSH, NULL));
/* Make sure that push is really not available */
r->transport->push = NULL;
@@ -273,7 +273,7 @@ void test_network_remote_remotes__nonmatch_upstream_refspec(void)
cl_git_pass(git_config_set_string(config, "branch.master.remote", "taggy"));
cl_git_pass(git_config_set_string(config, "branch.master.merge", "refs/heads/foo"));
- cl_git_pass(git_remote_fetch(remote, &specs, NULL));
+ cl_git_pass(git_remote_fetch(remote, &specs, NULL, NULL));
git_remote_free(remote);
}
@@ -408,7 +408,7 @@ void test_network_remote_remotes__can_load_with_an_empty_url(void)
cl_assert(remote->url == NULL);
cl_assert(remote->pushurl == NULL);
- cl_git_fail(git_remote_connect(remote, GIT_DIRECTION_FETCH));
+ cl_git_fail(git_remote_connect(remote, GIT_DIRECTION_FETCH, NULL));
cl_assert(giterr_last() != NULL);
cl_assert(giterr_last()->klass == GITERR_INVALID);
@@ -425,7 +425,7 @@ void test_network_remote_remotes__can_load_with_only_an_empty_pushurl(void)
cl_assert(remote->url == NULL);
cl_assert(remote->pushurl == NULL);
- cl_git_fail(git_remote_connect(remote, GIT_DIRECTION_FETCH));
+ cl_git_fail(git_remote_connect(remote, GIT_DIRECTION_FETCH, NULL));
git_remote_free(remote);
}
@@ -519,6 +519,6 @@ void test_network_remote_remotes__fetch_from_anonymous(void)
cl_git_pass(git_remote_create_anonymous(&remote, _repo, cl_fixture("testrepo.git"),
"refs/heads/*:refs/other/*"));
- cl_git_pass(git_remote_fetch(remote, NULL, NULL));
+ cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
git_remote_free(remote);
}