summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-12-16 10:05:49 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-12-16 10:05:49 +0100
commit3ded7f28c7bb1ad326fda82a6ea55ddb5dc7b8e0 (patch)
tree26d8bb73aff5282ec1bd1e8bb5c0842c4f67661d
parent4eb97ef3bf18403fbce351ae4cac673655d2886a (diff)
downloadlibgit2-3ded7f28c7bb1ad326fda82a6ea55ddb5dc7b8e0.tar.gz
local: add failing test for sideband information
We do not currently generate any messages when we're counting the objects, as might be expected from a local upload-pack. Assert that we do call the function when working.
-rw-r--r--tests/network/fetchlocal.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/network/fetchlocal.c b/tests/network/fetchlocal.c
index 736261b31..b78253dc3 100644
--- a/tests/network/fetchlocal.c
+++ b/tests/network/fetchlocal.c
@@ -162,3 +162,37 @@ void test_network_fetchlocal__multi_remotes(void)
git_remote_free(test);
git_remote_free(test2);
}
+
+static int sideband_cb(const char *str, int len, void *payload)
+{
+ int *count = (int *) payload;
+
+ GIT_UNUSED(str);
+ GIT_UNUSED(len);
+
+ (*count)++;
+ return 0;
+}
+
+void test_network_fetchlocal__call_progress(void)
+{
+ git_repository *repo;
+ git_remote *remote;
+ git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+ int callcount = 0;
+
+ cl_git_pass(git_repository_init(&repo, "foo.git", true));
+ cl_set_cleanup(cleanup_local_repo, "foo.git");
+
+ 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));
+
+ cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
+ cl_assert(callcount != 0);
+
+ git_remote_free(remote);
+ git_repository_free(repo);
+}