Commit a4b6452a by Carlos Martín Nieto

remote: remove git_remote_save()

It has now become a no-op, so remove the function and all references to
it.
parent 77254990
......@@ -28,8 +28,7 @@ GIT_BEGIN_DECL
typedef int (*git_remote_rename_problem_cb)(const char *problematic_refspec, void *payload);
/**
* Add a remote with the default fetch refspec to the repository's configuration. This
* calls git_remote_save before returning.
* Add a remote with the default fetch refspec to the repository's configuration.
*
* @param out the resulting remote
* @param repo the repository in which to create the remote
......@@ -45,8 +44,7 @@ GIT_EXTERN(int) git_remote_create(
/**
* Add a remote with the provided fetch refspec (or default if NULL) to the repository's
* configuration. This
* calls git_remote_save before returning.
* configuration.
*
* @param out the resulting remote
* @param repo the repository in which to create the remote
......@@ -98,17 +96,6 @@ GIT_EXTERN(int) git_remote_create_anonymous(
GIT_EXTERN(int) git_remote_lookup(git_remote **out, git_repository *repo, const char *name);
/**
* Save a remote to its repository's configuration
*
* One can't save a in-memory remote. Doing so will
* result in a GIT_EINVALIDSPEC being returned.
*
* @param remote the remote to save to config
* @return 0, GIT_EINVALIDSPEC or an error code
*/
GIT_EXTERN(int) git_remote_save(const git_remote *remote);
/**
* Create a copy of an existing remote. All internal strings are also
* duplicated. Callbacks are not duplicated.
*
......
......@@ -279,9 +279,6 @@ static int create_and_configure_origin(
if ((error = remote_create(&origin, repo, "origin", url, payload)) < 0)
goto on_error;
if ((error = git_remote_save(origin)) < 0)
goto on_error;
*out = origin;
return 0;
......
......@@ -302,9 +302,6 @@ int git_remote_create_with_fetchspec(git_remote **out, git_repository *repo, con
if (create_internal(&remote, repo, name, url, fetch) < 0)
goto on_error;
if (git_remote_save(remote) < 0)
goto on_error;
*out = remote;
return 0;
......@@ -595,27 +592,6 @@ cleanup:
return error;
}
int git_remote_save(const git_remote *remote)
{
int error;
git_config *cfg;
assert(remote);
if (!remote->name) {
giterr_set(GITERR_INVALID, "Can't save an anonymous remote.");
return GIT_EINVALIDSPEC;
}
if ((error = ensure_remote_name_is_valid(remote->name)) < 0)
return error;
if ((error = git_repository_config__weakptr(&cfg, remote->repo)) < 0)
return error;
return error;
}
const char *git_remote_name(const git_remote *remote)
{
assert(remote);
......
......@@ -319,18 +319,6 @@ void test_network_remote_remotes__cannot_add_a_nameless_remote(void)
git_remote_create(&remote, _repo, NULL, "git://github.com/libgit2/libgit2"));
}
void test_network_remote_remotes__cannot_save_an_inmemory_remote(void)
{
git_remote *remote;
cl_git_pass(git_remote_create_anonymous(&remote, _repo, "git://github.com/libgit2/libgit2", NULL));
cl_assert_equal_p(NULL, git_remote_name(remote));
cl_git_fail(git_remote_save(remote));
git_remote_free(remote);
}
void test_network_remote_remotes__cannot_add_a_remote_with_an_invalid_name(void)
{
git_remote *remote = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment