diff options
author | Ben Straub <bs@github.com> | 2012-12-20 11:49:05 -0800 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2012-12-20 12:01:13 -0800 |
commit | 874dcb25eba8637ed6d2a070741dd0363e30d83d (patch) | |
tree | 891ca2303954c0975995fc3758057959350444ef /tests-clar/network | |
parent | 29f27599eab750d2b4b8935a14be8b596b7affe2 (diff) | |
download | libgit2-874dcb25eba8637ed6d2a070741dd0363e30d83d.tar.gz |
Remote: deprecate dangling, prevent saving in-memory
Diffstat (limited to 'tests-clar/network')
-rw-r--r-- | tests-clar/network/remoterename.c | 17 | ||||
-rw-r--r-- | tests-clar/network/remotes.c | 25 |
2 files changed, 4 insertions, 38 deletions
diff --git a/tests-clar/network/remoterename.c b/tests-clar/network/remoterename.c index 35d197e71..e960cd75e 100644 --- a/tests-clar/network/remoterename.c +++ b/tests-clar/network/remoterename.c @@ -148,23 +148,6 @@ void test_network_remoterename__cannot_overwrite_an_existing_remote(void) cl_assert_equal_i(GIT_EEXISTS, git_remote_rename(_remote, "test_with_pushurl", dont_call_me_cb, NULL)); } -void test_network_remoterename__renaming_an_inmemory_remote_persists_it(void) -{ - git_remote *remote; - - assert_config_entry_existence(_repo, "remote.durable.url", false); - - cl_git_pass(git_remote_create_inmemory(&remote, _repo, NULL, "git://github.com/libgit2/durable.git", NULL)); - - assert_config_entry_existence(_repo, "remote.durable.url", false); - - cl_git_pass(git_remote_rename(remote, "durable", dont_call_me_cb, NULL)); - - assert_config_entry_value(_repo, "remote.durable.url", "git://github.com/libgit2/durable.git"); - - git_remote_free(remote); -} - void test_network_remoterename__renaming_an_inmemory_nameless_remote_notifies_the_inability_to_update_the_fetch_refspec(void) { git_remote *remote; diff --git a/tests-clar/network/remotes.c b/tests-clar/network/remotes.c index 15e3b03f4..b776353a2 100644 --- a/tests-clar/network/remotes.c +++ b/tests-clar/network/remotes.c @@ -108,7 +108,7 @@ void test_network_remotes__save(void) _remote = NULL; /* Set up the remote and save it to config */ - cl_git_pass(git_remote_create_inmemory(&_remote, _repo, "upstream", "git://github.com/libgit2/libgit2", NULL)); + cl_git_pass(git_remote_create(&_remote, _repo, "upstream", "git://github.com/libgit2/libgit2")); cl_git_pass(git_remote_set_fetchspec(_remote, "refs/heads/*:refs/remotes/upstream/*")); cl_git_pass(git_remote_set_pushspec(_remote, "refs/heads/*:refs/heads/*")); cl_git_pass(git_remote_set_pushurl(_remote, "git://github.com/libgit2/libgit2_push")); @@ -123,7 +123,7 @@ void test_network_remotes__save(void) cl_assert(_refspec != NULL); cl_assert_equal_s(git_refspec_src(_refspec), "refs/heads/*"); cl_assert_equal_s(git_refspec_dst(_refspec), "refs/remotes/upstream/*"); - cl_assert(git_refspec_force(_refspec) == 0); + cl_assert_equal_i(0, git_refspec_force(_refspec)); _refspec = git_remote_pushspec(_remote); cl_assert(_refspec != NULL); @@ -251,13 +251,13 @@ void test_network_remotes__cannot_add_a_nameless_remote(void) git_remote_create(&remote, _repo, NULL, "git://github.com/libgit2/libgit2")); } -void test_network_remotes__cannot_save_a_nameless_remote(void) +void test_network_remotes__cant_save_inmem_remote(void) { git_remote *remote; cl_git_pass(git_remote_create_inmemory(&remote, _repo, NULL, "git://github.com/libgit2/libgit2", NULL)); - cl_assert_equal_i(GIT_EINVALIDSPEC, git_remote_save(remote)); + cl_git_fail(git_remote_save(remote)); git_remote_free(remote); } @@ -344,20 +344,3 @@ void test_network_remotes__check_structure_version(void) err = giterr_last(); cl_assert_equal_i(GITERR_INVALID, err->klass); } - -void test_network_remotes__dangling(void) -{ - git_remote_free(_remote); - _remote = NULL; - - cl_git_pass(git_remote_create_inmemory(&_remote, NULL, "upstream", "git://github.com/libgit2/libgit2", NULL)); - - cl_git_pass(git_remote_rename(_remote, "newname", NULL, NULL)); - cl_assert_equal_s(git_remote_name(_remote), "newname"); - - cl_git_fail(git_remote_save(_remote)); - cl_git_fail(git_remote_update_tips(_remote)); - - cl_git_pass(git_remote_set_repository(_remote, _repo)); - cl_git_pass(git_remote_save(_remote)); -} |