summaryrefslogtreecommitdiff
path: root/tests-clar/network/fetch.c
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2012-10-17 14:02:24 -0700
committerBen Straub <bs@github.com>2012-10-19 19:36:22 -0700
commit216863c48fd05b08e9b0083d61dcb163a2add62a (patch)
tree783430092fa565740a2a42c3b761da13a65c8d52 /tests-clar/network/fetch.c
parent0ae81fc479bf3cf7ed31b3e3b070de7990102f1d (diff)
downloadlibgit2-216863c48fd05b08e9b0083d61dcb163a2add62a.tar.gz
Fetch/indexer: progress callbacks
Diffstat (limited to 'tests-clar/network/fetch.c')
-rw-r--r--tests-clar/network/fetch.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests-clar/network/fetch.c b/tests-clar/network/fetch.c
index 1e9a2323e..134e8fe2e 100644
--- a/tests-clar/network/fetch.c
+++ b/tests-clar/network/fetch.c
@@ -28,11 +28,19 @@ static int update_tips(const char *refname, const git_oid *a, const git_oid *b,
return 0;
}
+static void progress(const git_indexer_stats *stats, void *payload)
+{
+ GIT_UNUSED(stats);
+ bool *was_called = (bool*)payload;
+ *was_called = true;
+}
+
static void do_fetch(const char *url, int flag, int n)
{
git_remote *remote;
git_off_t bytes;
git_remote_callbacks callbacks;
+ bool progress_was_called = false;
memset(&callbacks, 0, sizeof(git_remote_callbacks));
callbacks.update_tips = update_tips;
@@ -42,10 +50,11 @@ static void do_fetch(const char *url, int flag, int n)
git_remote_set_callbacks(remote, &callbacks);
git_remote_set_autotag(remote, flag);
cl_git_pass(git_remote_connect(remote, GIT_DIR_FETCH));
- cl_git_pass(git_remote_download(remote, &bytes));
+ cl_git_pass(git_remote_download(remote, &bytes, progress, &progress_was_called));
git_remote_disconnect(remote);
cl_git_pass(git_remote_update_tips(remote));
cl_assert_equal_i(counter, n);
+ cl_assert_equal_i(progress_was_called, true);
git_remote_free(remote);
}