Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-04-23 07:51:34 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-13 10:46:36 +0300
commit7725499072aaf4d9093c615fee5a65d8477100bc (patch)
treefc68cffcafe2d9e762729334dfe2f7a4ee15783e /tests/online
parent3fec548a989b09fc7a2c30f42b1d4fa123a8867e (diff)
remote: remove live changing of refspecs
The base refspecs changing can be a cause of confusion as to what is the current base refspec set and complicate saving the remote's configuration. Change `git_remote_add_{fetch,push}()` to update the configuration instead of an instance. This finally makes `git_remote_save()` a no-op, it will be removed in a later commit.
Diffstat (limited to 'tests/online')
-rw-r--r--tests/online/clone.c9
-rw-r--r--tests/online/push.c6
2 files changed, 6 insertions, 9 deletions
diff --git a/tests/online/clone.c b/tests/online/clone.c
index 1d4196948..1930a8ba3 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -134,16 +134,9 @@ static int remote_mirror_cb(git_remote **out, git_repository *repo,
GIT_UNUSED(payload);
- if ((error = git_remote_create(&remote, repo, name, url)) < 0)
+ if ((error = git_remote_create_with_fetchspec(&remote, repo, name, url, "+refs/*:refs/*")) < 0)
return error;
- git_remote_clear_refspecs(remote);
-
- if ((error = git_remote_add_fetch(remote, "+refs/*:refs/*")) < 0) {
- git_remote_free(remote);
- return error;
- }
-
*out = remote;
return 0;
}
diff --git a/tests/online/push.c b/tests/online/push.c
index b35632755..04ad7a2ed 100644
--- a/tests/online/push.c
+++ b/tests/online/push.c
@@ -861,6 +861,7 @@ void test_online_push__configured(void)
{
git_oid note_oid, *target_oid, expected_oid;
git_signature *signature;
+ git_remote *old_remote;
const char *specs[] = { "refs/notes/commits:refs/notes/commits" };
push_status exp_stats[] = { { "refs/notes/commits", 1 } };
expected_ref exp_refs[] = { { "refs/notes/commits", &expected_oid } };
@@ -870,7 +871,10 @@ void test_online_push__configured(void)
target_oid = &_oid_b6;
- cl_git_pass(git_remote_add_push(_remote, specs[0]));
+ cl_git_pass(git_remote_add_push(_repo, git_remote_name(_remote), specs[0]));
+ old_remote = _remote;
+ cl_git_pass(git_remote_lookup(&_remote, _repo, git_remote_name(_remote)));
+ git_remote_free(old_remote);
/* Create note to push */
cl_git_pass(git_signature_new(&signature, "nulltoken", "emeric.fermas@gmail.com", 1323847743, 60)); /* Wed Dec 14 08:29:03 2011 +0100 */