summaryrefslogtreecommitdiff
path: root/tests-clar/online/clone.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/online/clone.c')
-rw-r--r--tests-clar/online/clone.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests-clar/online/clone.c b/tests-clar/online/clone.c
index 6a46fa511..020c29e9f 100644
--- a/tests-clar/online/clone.c
+++ b/tests-clar/online/clone.c
@@ -81,11 +81,12 @@ static void checkout_progress(const char *path, size_t cur, size_t tot, void *pa
(*was_called) = true;
}
-static void fetch_progress(const git_transfer_progress *stats, void *payload)
+static int fetch_progress(const git_transfer_progress *stats, void *payload)
{
bool *was_called = (bool*)payload;
GIT_UNUSED(stats);
(*was_called) = true;
+ return 0;
}
void test_online_clone__can_checkout_a_cloned_repo(void)
@@ -182,3 +183,18 @@ void test_online_clone__bitbucket_style(void)
git_repository_free(g_repo); g_repo = NULL;
cl_fixture_cleanup("./foo");
}
+
+static int cancel_at_half(const git_transfer_progress *stats, void *payload)
+{
+ GIT_UNUSED(payload);
+
+ if (stats->received_objects > (stats->total_objects/2))
+ return -1;
+ return 0;
+}
+
+void test_online_clone__can_cancel(void)
+{
+ g_options.fetch_progress_cb = cancel_at_half;
+ cl_git_fail_with(git_clone(&g_repo, LIVE_REPO_URL, "./foo", &g_options), GIT_EUSER);
+}