Add network::fetchlocal multi remotes test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/tests/network/fetchlocal.c b/tests/network/fetchlocal.c
index 8809f42..f5cb66f 100644
--- a/tests/network/fetchlocal.c
+++ b/tests/network/fetchlocal.c
@@ -127,3 +127,37 @@ void test_network_fetchlocal__clone_into_mirror(void)
git_repository_free(repo);
cl_fixture_cleanup("./foo.git");
}
+
+void test_network_fetchlocal__multi_remotes(void)
+{
+ git_repository *repo = cl_git_sandbox_init("testrepo.git");
+ git_remote *test, *test2;
+ git_strarray refnames = {0};
+ git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+
+ callbacks.transfer_progress = transfer_cb;
+ cl_git_pass(git_remote_load(&test, repo, "test"));
+ cl_git_pass(git_remote_set_url(test, cl_git_fixture_url("testrepo.git")));
+ git_remote_set_callbacks(test, &callbacks);
+ cl_git_pass(git_remote_connect(test, GIT_DIRECTION_FETCH));
+ cl_git_pass(git_remote_download(test));
+ cl_git_pass(git_remote_update_tips(test, NULL, NULL));
+
+ cl_git_pass(git_reference_list(&refnames, repo));
+ cl_assert_equal_i(32, (int)refnames.count);
+
+ cl_git_pass(git_remote_load(&test2, repo, "test_with_pushurl"));
+ cl_git_pass(git_remote_set_url(test2, cl_git_fixture_url("testrepo.git")));
+ git_remote_set_callbacks(test2, &callbacks);
+ cl_git_pass(git_remote_connect(test2, GIT_DIRECTION_FETCH));
+ cl_git_pass(git_remote_download(test2));
+ cl_git_pass(git_remote_update_tips(test2, NULL, NULL));
+
+ cl_git_pass(git_reference_list(&refnames, repo));
+ cl_assert_equal_i(44, (int)refnames.count);
+
+ git_strarray_free(&refnames);
+ git_remote_free(test);
+ git_remote_free(test2);
+ git_repository_free(repo);
+}