diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-04-22 17:29:20 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-05-13 09:46:36 +0200 |
commit | 35a8a8c546fe3d0a5bc7df7cf418244133ccf238 (patch) | |
tree | 891e878a61ce7c0d17881171029c76c7d6c94430 /tests/network | |
parent | 3eff2a57289ec19b1a805dd938299d1dcae47097 (diff) | |
download | libgit2-35a8a8c546fe3d0a5bc7df7cf418244133ccf238.tar.gz |
remote: move the tagopt setting to the fetch options
This is another option which we should not be keeping in the remote, but
is specific to each particular operation.
Diffstat (limited to 'tests/network')
-rw-r--r-- | tests/network/remote/local.c | 24 | ||||
-rw-r--r-- | tests/network/remote/remotes.c | 11 |
2 files changed, 15 insertions, 20 deletions
diff --git a/tests/network/remote/local.c b/tests/network/remote/local.c index 9134b60b1..bcde50cbb 100644 --- a/tests/network/remote/local.c +++ b/tests/network/remote/local.c @@ -165,26 +165,26 @@ void test_network_remote_local__shorthand_fetch_refspec1(void) cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL)); - cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master")); - + cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/origin/master")); cl_git_fail(git_reference_lookup(&ref, repo, "refs/tags/hard_tag")); } void test_network_remote_local__tagopt(void) { git_reference *ref; + git_fetch_options fetch_opts = GIT_FETCH_OPTIONS_INIT; cl_git_pass(git_remote_create(&remote, repo, "tagopt", cl_git_path_url(cl_fixture("testrepo.git")))); - git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_ALL); - cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL)); + fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_ALL; + cl_git_pass(git_remote_fetch(remote, NULL, &fetch_opts, NULL)); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/tagopt/master")); git_reference_free(ref); cl_git_pass(git_reference_lookup(&ref, repo, "refs/tags/hard_tag")); git_reference_free(ref); - git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_AUTO); - cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL)); + fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO; + cl_git_pass(git_remote_fetch(remote, NULL, &fetch_opts, NULL)); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/tagopt/master")); git_reference_free(ref); } @@ -240,9 +240,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_download(remote, &array, NULL)); - cl_git_pass(git_remote_update_tips(remote, NULL, 1, NULL)); - git_remote_disconnect(remote); + cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL)); /* Set up an empty bare repo to push into */ { @@ -278,12 +276,11 @@ void test_network_remote_local__push_to_non_bare_remote(void) }; /* Shouldn't be able to push to a non-bare remote */ git_remote *localremote; + git_fetch_options fetch_opts = GIT_FETCH_OPTIONS_INIT; /* Get some commits */ connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_download(remote, &array, NULL)); - cl_git_pass(git_remote_update_tips(remote, NULL, 1, NULL)); - git_remote_disconnect(remote); + cl_git_pass(git_remote_fetch(remote, &array, &fetch_opts, NULL)); /* Set up an empty non-bare repo to push into */ { @@ -349,8 +346,7 @@ void test_network_remote_local__reflog(void) connect_to_local_repository(cl_fixture("testrepo.git")); - cl_git_pass(git_remote_download(remote, &array, NULL)); - cl_git_pass(git_remote_update_tips(remote, NULL, 1, "UPDAAAAAATE!!")); + cl_git_pass(git_remote_fetch(remote, &array, NULL, "UPDAAAAAATE!!")); cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); cl_assert_equal_i(1, git_reflog_entrycount(log)); diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c index f31993710..819a22601 100644 --- a/tests/network/remote/remotes.c +++ b/tests/network/remote/remotes.c @@ -395,16 +395,15 @@ void test_network_remote_remotes__cannot_add_a_remote_with_an_invalid_name(void) void test_network_remote_remotes__tagopt(void) { - git_remote_set_autotag(_remote, GIT_REMOTE_DOWNLOAD_TAGS_ALL); - cl_git_pass(git_remote_save(_remote)); + const char *name = git_remote_name(_remote); + + git_remote_set_autotag(_repo, name, GIT_REMOTE_DOWNLOAD_TAGS_ALL); assert_config_entry_value(_repo, "remote.test.tagopt", "--tags"); - git_remote_set_autotag(_remote, GIT_REMOTE_DOWNLOAD_TAGS_NONE); - cl_git_pass(git_remote_save(_remote)); + git_remote_set_autotag(_repo, name, GIT_REMOTE_DOWNLOAD_TAGS_NONE); assert_config_entry_value(_repo, "remote.test.tagopt", "--no-tags"); - git_remote_set_autotag(_remote, GIT_REMOTE_DOWNLOAD_TAGS_AUTO); - cl_git_pass(git_remote_save(_remote)); + git_remote_set_autotag(_repo, name, GIT_REMOTE_DOWNLOAD_TAGS_AUTO); assert_config_entry_existence(_repo, "remote.test.tagopt", false); } |