remote: remove git_remote_save() It has now become a no-op, so remove the function and all references to it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
diff --git a/include/git2/remote.h b/include/git2/remote.h
index 73440a9..ab14ad4 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -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.
*
diff --git a/src/clone.c b/src/clone.c
index c44cf59..8b42ce7 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -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;
diff --git a/src/remote.c b/src/remote.c
index f4a2f04..891f0f2 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -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);
diff --git a/tests/network/remote/remotes.c b/tests/network/remote/remotes.c
index 0da76da..f81c1cc 100644
--- a/tests/network/remote/remotes.c
+++ b/tests/network/remote/remotes.c
@@ -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;