summaryrefslogtreecommitdiff
path: root/tests/network/remote
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-04-22 04:38:08 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-13 09:46:36 +0200
commit22261344de18b3cc60ee6937468d66a6a6a28875 (patch)
tree6b12365545f66fb0ea274bf034049da3bb397176 /tests/network/remote
parent8f0104ecc54db00a075310ab744a19eb60e3d740 (diff)
downloadlibgit2-22261344de18b3cc60ee6937468d66a6a6a28875.tar.gz
remote: remove url and pushurl from the save logic
As a first step in removing the repository-saving logic, don't allow chaning the url or push url from a remote object, but change the configuration on the configuration immediately.
Diffstat (limited to 'tests/network/remote')
-rw-r--r--tests/network/remote/remotes.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c
index 456fb39fe..8dbd68f2d 100644
--- a/tests/network/remote/remotes.c
+++ b/tests/network/remote/remotes.c
@@ -54,11 +54,18 @@ void test_network_remote_remotes__parsing(void)
void test_network_remote_remotes__pushurl(void)
{
- cl_git_pass(git_remote_set_pushurl(_remote, "git://github.com/libgit2/notlibgit2"));
- cl_assert_equal_s(git_remote_pushurl(_remote), "git://github.com/libgit2/notlibgit2");
+ const char *name = git_remote_name(_remote);
+ git_remote *mod;
- cl_git_pass(git_remote_set_pushurl(_remote, NULL));
- cl_assert(git_remote_pushurl(_remote) == NULL);
+ cl_git_pass(git_remote_set_pushurl(_repo, name, "git://github.com/libgit2/notlibgit2"));
+ cl_git_pass(git_remote_lookup(&mod, _repo, name));
+ cl_assert_equal_s(git_remote_pushurl(mod), "git://github.com/libgit2/notlibgit2");
+ git_remote_free(mod);
+
+ cl_git_pass(git_remote_set_pushurl(_repo, name, NULL));
+ cl_git_pass(git_remote_lookup(&mod, _repo, name));
+ cl_assert(git_remote_pushurl(mod) == NULL);
+ git_remote_free(mod);
}
void test_network_remote_remotes__error_when_not_found(void)
@@ -174,13 +181,16 @@ void test_network_remote_remotes__save(void)
/* Set up the remote and save it to config */
cl_git_pass(git_remote_create(&_remote, _repo, "upstream", "git://github.com/libgit2/libgit2"));
+ git_remote_free(_remote);
+ cl_git_pass(git_remote_set_pushurl(_repo, "upstream", "git://github.com/libgit2/libgit2_push"));
+ cl_git_pass(git_remote_lookup(&_remote, _repo, "upstream"));
+
git_remote_clear_refspecs(_remote);
cl_git_pass(git_remote_add_fetch(_remote, fetch_refspec1));
cl_git_pass(git_remote_add_fetch(_remote, fetch_refspec2));
cl_git_pass(git_remote_add_push(_remote, push_refspec1));
cl_git_pass(git_remote_add_push(_remote, push_refspec2));
- cl_git_pass(git_remote_set_pushurl(_remote, "git://github.com/libgit2/libgit2_push"));
cl_git_pass(git_remote_save(_remote));
git_remote_free(_remote);
_remote = NULL;
@@ -203,12 +213,11 @@ void test_network_remote_remotes__save(void)
cl_assert_equal_s(git_remote_url(_remote), "git://github.com/libgit2/libgit2");
cl_assert_equal_s(git_remote_pushurl(_remote), "git://github.com/libgit2/libgit2_push");
- /* remove the pushurl again and see if we can save that too */
- cl_git_pass(git_remote_set_pushurl(_remote, NULL));
- cl_git_pass(git_remote_save(_remote));
git_remote_free(_remote);
_remote = NULL;
+ /* remove the pushurl again and see if we can save that too */
+ cl_git_pass(git_remote_set_pushurl(_repo, "upstream", NULL));
cl_git_pass(git_remote_lookup(&_remote, _repo, "upstream"));
cl_assert(git_remote_pushurl(_remote) == NULL);
}