void test_network_remote_remotes__query_refspecs(void) { git_remote *remote; git_strarray array; int i; cl_git_pass(git_remote_create_with_fetchspec(&remote, _repo, "query", "git://github.com/libgit2/libgit2", NULL)); git_remote_free(remote); for (i = 0; i < 3; i++) { cl_git_pass(git_remote_add_fetch(_repo, "query", fetch_refspecs[i])); cl_git_pass(git_remote_add_push(_repo, "query", push_refspecs[i])); } cl_git_pass(git_remote_lookup(&remote, _repo, "query")); cl_git_pass(git_remote_get_fetch_refspecs(&array, remote)); for (i = 0; i < 3; i++) { cl_assert_equal_s(fetch_refspecs[i], array.strings[i]); } git_strarray_free(&array); cl_git_pass(git_remote_get_push_refspecs(&array, remote)); for (i = 0; i < 3; i++) { cl_assert_equal_s(push_refspecs[i], array.strings[i]); } git_strarray_free(&array); git_remote_free(remote); git_remote_delete(_repo, "test"); }
void test_network_remote_remote__git_remote_create_with_fetchspec(void) { git_remote *remote; git_strarray array; cl_git_pass(git_remote_create_with_fetchspec(&remote, _repo, "test-new", "git://github.com/libgit2/libgit2", "+refs/*:refs/*")); git_remote_get_fetch_refspecs(&array, remote); cl_assert_equal_s("+refs/*:refs/*", array.strings[0]); git_remote_free(remote); }
static int remote_mirror_cb(git_remote **out, git_repository *repo, const char *name, const char *url, void *payload) { int error; git_remote *remote; GIT_UNUSED(payload); if ((error = git_remote_create_with_fetchspec(&remote, repo, name, url, "+refs/*:refs/*")) < 0) return error; *out = remote; return 0; }