diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2014-12-20 21:22:30 -0600 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2014-12-20 21:22:30 -0600 |
| commit | c7d9839f54f62849ef528b97b60a39fd21f54c5a (patch) | |
| tree | 08a38e6cfc15ee7332f129ba473e571aeb3ecf43 /tests | |
| parent | 0de26b7c4a893ad72708057639cafe0a97ef9496 (diff) | |
| parent | 4fd2bda9ff3130496c079cd0a7232ff5252a9842 (diff) | |
| download | libgit2-c7d9839f54f62849ef528b97b60a39fd21f54c5a.tar.gz | |
Merge pull request #2763 from libgit2/cmn/local-proto-progress
Show progress output on fetch for the local transport
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/network/fetchlocal.c | 34 |
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); +} |
