diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2014-06-06 15:24:53 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-09-30 15:42:32 +0200 |
| commit | 9c206a2248e74f385c5f1a9928560efd97e3922f (patch) | |
| tree | 819b3b591d159b5393a025cc392073eca5e7fa99 /tests/network/remote | |
| parent | 3f8942052306a9d62521bdb6e6d5e7636bc5526e (diff) | |
| download | libgit2-9c206a2248e74f385c5f1a9928560efd97e3922f.tar.gz | |
remote: use active refspec override in the tests
This lets us test this bit as well as getting closer to what they were
trying to do.
Diffstat (limited to 'tests/network/remote')
| -rw-r--r-- | tests/network/remote/local.c | 91 |
1 files changed, 66 insertions, 25 deletions
diff --git a/tests/network/remote/local.c b/tests/network/remote/local.c index 0fbed6024..ceccf45d0 100644 --- a/tests/network/remote/local.c +++ b/tests/network/remote/local.c @@ -116,16 +116,20 @@ void test_network_remote_local__nested_tags_are_completely_peeled(void) void test_network_remote_local__shorthand_fetch_refspec0(void) { - const char *refspec = "master:remotes/sloppy/master"; - const char *refspec2 = "master:boh/sloppy/master"; + char *refspec_strings[] = { + "master:remotes/sloppy/master", + "master:boh/sloppy/master", + }; + git_strarray array = { + refspec_strings, + 2, + }; git_reference *ref; connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_add_fetch(remote, refspec)); - cl_git_pass(git_remote_add_fetch(remote, refspec2)); - cl_git_pass(git_remote_download(remote, NULL)); + cl_git_pass(git_remote_download(remote, &array)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master")); @@ -137,17 +141,21 @@ void test_network_remote_local__shorthand_fetch_refspec0(void) void test_network_remote_local__shorthand_fetch_refspec1(void) { - const char *refspec = "master"; - const char *refspec2 = "hard_tag"; + char *refspec_strings[] = { + "master", + "hard_tag", + }; + git_strarray array = { + refspec_strings, + 2, + }; git_reference *ref; connect_to_local_repository(cl_fixture("testrepo.git")); git_remote_clear_refspecs(remote); - cl_git_pass(git_remote_add_fetch(remote, refspec)); - cl_git_pass(git_remote_add_fetch(remote, refspec2)); - cl_git_pass(git_remote_download(remote, NULL)); + cl_git_pass(git_remote_download(remote, &array)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master")); @@ -174,14 +182,20 @@ void test_network_remote_local__tagopt(void) void test_network_remote_local__push_to_bare_remote(void) { + char *refspec_strings[] = { + "master:master", + }; + git_strarray array = { + refspec_strings, + 1, + }; /* Should be able to push to a bare remote */ git_remote *localremote; git_push *push; /* Get some commits */ connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_add_fetch(remote, "master:master")); - cl_git_pass(git_remote_download(remote, NULL)); + cl_git_pass(git_remote_download(remote, &array)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); git_remote_disconnect(remote); @@ -210,6 +224,13 @@ void test_network_remote_local__push_to_bare_remote(void) void test_network_remote_local__push_to_bare_remote_with_file_url(void) { + char *refspec_strings[] = { + "master:master", + }; + git_strarray array = { + refspec_strings, + 1, + }; /* Should be able to push to a bare remote */ git_remote *localremote; git_push *push; @@ -217,8 +238,7 @@ void test_network_remote_local__push_to_bare_remote_with_file_url(void) /* Get some commits */ connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_add_fetch(remote, "master:master")); - cl_git_pass(git_remote_download(remote, NULL)); + cl_git_pass(git_remote_download(remote, &array)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); git_remote_disconnect(remote); @@ -251,14 +271,20 @@ void test_network_remote_local__push_to_bare_remote_with_file_url(void) void test_network_remote_local__push_to_non_bare_remote(void) { + char *refspec_strings[] = { + "master:master", + }; + git_strarray array = { + refspec_strings, + 1, + }; /* Shouldn't be able to push to a non-bare remote */ git_remote *localremote; git_push *push; /* Get some commits */ connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_add_fetch(remote, "master:master")); - cl_git_pass(git_remote_download(remote, NULL)); + cl_git_pass(git_remote_download(remote, &array)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL)); git_remote_disconnect(remote); @@ -287,7 +313,13 @@ void test_network_remote_local__push_to_non_bare_remote(void) void test_network_remote_local__fetch(void) { - const char *refspec = "master:remotes/sloppy/master"; + char *refspec_strings[] = { + "master:remotes/sloppy/master", + }; + git_strarray array = { + refspec_strings, + 1, + }; git_reflog *log; const git_reflog_entry *entry; @@ -297,9 +329,8 @@ void test_network_remote_local__fetch(void) cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com")); connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_add_fetch(remote, refspec)); - cl_git_pass(git_remote_fetch(remote, NULL, sig, "UPDAAAAAATE!!")); + cl_git_pass(git_remote_fetch(remote, &array, sig, "UPDAAAAAATE!!")); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master")); git_reference_free(ref); @@ -316,7 +347,13 @@ void test_network_remote_local__fetch(void) void test_network_remote_local__reflog(void) { - const char *refspec = "master:remotes/sloppy/master"; + char *refspec_strings[] = { + "master:remotes/sloppy/master", + }; + git_strarray array = { + refspec_strings, + 1, + }; git_reflog *log; const git_reflog_entry *entry; @@ -325,9 +362,8 @@ void test_network_remote_local__reflog(void) cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com")); connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_add_fetch(remote, refspec)); - cl_git_pass(git_remote_download(remote, NULL)); + cl_git_pass(git_remote_download(remote, &array)); cl_git_pass(git_remote_update_tips(remote, sig, "UPDAAAAAATE!!")); cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); @@ -342,7 +378,13 @@ void test_network_remote_local__reflog(void) void test_network_remote_local__fetch_default_reflog_message(void) { - const char *refspec = "master:remotes/sloppy/master"; + char *refspec_strings[] = { + "master:remotes/sloppy/master", + }; + git_strarray array = { + refspec_strings, + 1, + }; git_reflog *log; const git_reflog_entry *entry; @@ -352,9 +394,8 @@ void test_network_remote_local__fetch_default_reflog_message(void) cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com")); connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_add_fetch(remote, refspec)); - cl_git_pass(git_remote_fetch(remote, NULL, sig, NULL)); + cl_git_pass(git_remote_fetch(remote, &array, sig, NULL)); cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); cl_assert_equal_i(1, git_reflog_entrycount(log)); |
