summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-04-22 17:29:20 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-13 09:46:36 +0200
commit35a8a8c546fe3d0a5bc7df7cf418244133ccf238 (patch)
tree891e878a61ce7c0d17881171029c76c7d6c94430 /tests
parent3eff2a57289ec19b1a805dd938299d1dcae47097 (diff)
downloadlibgit2-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')
-rw-r--r--tests/network/remote/local.c24
-rw-r--r--tests/network/remote/remotes.c11
-rw-r--r--tests/online/fetch.c4
-rw-r--r--tests/online/fetchhead.c5
4 files changed, 20 insertions, 24 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);
}
diff --git a/tests/online/fetch.c b/tests/online/fetch.c
index da0df0ad5..72e7c24e3 100644
--- a/tests/online/fetch.c
+++ b/tests/online/fetch.c
@@ -41,10 +41,10 @@ static void do_fetch(const char *url, git_remote_autotag_option_t flag, int n)
options.callbacks.transfer_progress = progress;
options.callbacks.update_tips = update_tips;
options.callbacks.payload = &bytes_received;
+ options.download_tags = flag;
counter = 0;
cl_git_pass(git_remote_create(&remote, _repo, "test", url));
- git_remote_set_autotag(remote, flag);
cl_git_pass(git_remote_fetch(remote, NULL, &options, NULL));
cl_assert_equal_i(counter, n);
cl_assert(bytes_received > 0);
@@ -127,7 +127,7 @@ void test_online_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_date
cl_assert_equal_i(false, invoked);
- cl_git_pass(git_remote_update_tips(remote, &options.callbacks, 1, NULL));
+ cl_git_pass(git_remote_update_tips(remote, &options.callbacks, 1, options.download_tags, NULL));
git_remote_disconnect(remote);
git_remote_free(remote);
diff --git a/tests/online/fetchhead.c b/tests/online/fetchhead.c
index b24b1b511..200edacfd 100644
--- a/tests/online/fetchhead.c
+++ b/tests/online/fetchhead.c
@@ -38,12 +38,13 @@ static void fetchhead_test_clone(void)
static void fetchhead_test_fetch(const char *fetchspec, const char *expected_fetchhead)
{
git_remote *remote;
+ git_fetch_options fetch_opts = GIT_FETCH_OPTIONS_INIT;
git_buf fetchhead_buf = GIT_BUF_INIT;
int equals = 0;
git_strarray array, *active_refs = NULL;
cl_git_pass(git_remote_lookup(&remote, g_repo, "origin"));
- git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_AUTO);
+ fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO;
if(fetchspec != NULL) {
array.count = 1;
@@ -51,7 +52,7 @@ static void fetchhead_test_fetch(const char *fetchspec, const char *expected_fet
active_refs = &array;
}
- cl_git_pass(git_remote_fetch(remote, active_refs, NULL, NULL));
+ cl_git_pass(git_remote_fetch(remote, active_refs, &fetch_opts, NULL));
git_remote_free(remote);
cl_git_pass(git_futils_readbuffer(&fetchhead_buf, "./foo/.git/FETCH_HEAD"));