summaryrefslogtreecommitdiff
path: root/tests/online/push.c
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/online/push.c
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/online/push.c')
-rw-r--r--tests/online/push.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/tests/online/push.c b/tests/online/push.c
index 9b98bc77a..b35632755 100644
--- a/tests/online/push.c
+++ b/tests/online/push.c
@@ -369,9 +369,8 @@ void test_online_push__initialize(void)
cl_git_pass(git_remote_create(&_remote, _repo, "test", _remote_url));
record_callbacks_data_clear(&_record_cbs_data);
- git_remote_set_callbacks(_remote, &_record_cbs);
- cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_PUSH));
+ cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_PUSH, NULL));
/* Clean up previously pushed branches. Fails if receive.denyDeletes is
* set on the remote. Also, on Git 1.7.0 and newer, you must run
@@ -394,10 +393,7 @@ void test_online_push__initialize(void)
git_vector_free(&delete_specs);
/* Now that we've deleted everything, fetch from the remote */
- cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_FETCH));
- cl_git_pass(git_remote_download(_remote, NULL));
- cl_git_pass(git_remote_update_tips(_remote, NULL));
- git_remote_disconnect(_remote);
+ cl_git_pass(git_remote_fetch(_remote, NULL, NULL, NULL));
}
void test_online_push__cleanup(void)
@@ -459,20 +455,18 @@ static void do_push(
size_t i;
int error;
git_strarray specs = {0};
- git_remote_callbacks callbacks;
record_callbacks_data *data;
if (_remote) {
/* Auto-detect the number of threads to use */
opts.pb_parallelism = 0;
- memcpy(&callbacks, git_remote_get_callbacks(_remote), sizeof(callbacks));
- data = callbacks.payload;
+ memcpy(&opts.callbacks, &_record_cbs, sizeof(git_remote_callbacks));
+ data = opts.callbacks.payload;
- callbacks.pack_progress = push_pack_progress_cb;
- callbacks.push_transfer_progress = push_transfer_progress_cb;
- callbacks.push_update_reference = record_push_status_cb;
- cl_git_pass(git_remote_set_callbacks(_remote, &callbacks));
+ opts.callbacks.pack_progress = push_pack_progress_cb;
+ opts.callbacks.push_transfer_progress = push_transfer_progress_cb;
+ opts.callbacks.push_update_reference = record_push_status_cb;
if (refspecs_len) {
specs.count = refspecs_len;