remote: accept a repo and name for renaming

Remote objects are not meant to be changed from under the user. We did
this in rename, but only the name and left the refspecs, such that a
save would save the wrong refspecs (and a fetch and anything else would
use the wrong refspecs).

Instead, let's simply take a name and not change any loaded remote from
under the user.
This commit is contained in:
Carlos Martín Nieto
2014-10-24 16:25:59 +02:00
parent 4bb6ffb6bb
commit 46c8f7f845
5 changed files with 54 additions and 74 deletions
+1 -3
View File
@@ -94,12 +94,10 @@ void test_submodule_add__url_relative(void)
g_repo = cl_git_sandbox_init("testrepo2");
/* make sure we don't default to origin - rename origin -> test_remote */
cl_git_pass(git_remote_load(&remote, g_repo, "origin"));
cl_git_pass(git_remote_rename(&problems, remote, "test_remote"));
cl_git_pass(git_remote_rename(&problems, g_repo, "origin", "test_remote"));
cl_assert_equal_i(0, problems.count);
git_strarray_free(&problems);
cl_git_fail(git_remote_load(&remote, g_repo, "origin"));
git_remote_free(remote);
cl_git_pass(
git_submodule_add_setup(&sm, g_repo, "../TestGitRepository", "TestGitRepository", 1)