submodule: get rid of `_save()` We no longer have any setters which affect an instance, so `git_submodule_save()` is no longer relevant.
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
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index 16895ac..0169d1c 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -301,20 +301,6 @@ GIT_EXTERN(int) git_submodule_add_to_index(
int write_index);
/**
- * Write submodule settings to .gitmodules file.
- *
- * This commits any in-memory changes to the submodule to the gitmodules
- * file on disk. You may also be interested in `git_submodule_init()` which
- * writes submodule info to ".git/config" (which is better for local changes
- * to submodule settings) and/or `git_submodule_sync()` which writes
- * settings about remotes to the actual submodule repository.
- *
- * @param submodule The submodule to write.
- * @return 0 on success, <0 on failure.
- */
-GIT_EXTERN(int) git_submodule_save(git_submodule *submodule);
-
-/**
* Get the containing repository for a submodule.
*
* This returns a pointer to the repository that contains the submodule.
diff --git a/src/submodule.c b/src/submodule.c
index 24d31fe..738d579 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -764,44 +764,6 @@ const char *git_submodule_recurse_to_str(git_submodule_recurse_t recurse)
return NULL;
}
-int git_submodule_save(git_submodule *submodule)
-{
- int error = 0;
- git_config_backend *mods;
- git_buf key = GIT_BUF_INIT;
-
- assert(submodule);
-
- mods = open_gitmodules(submodule->repo, GITMODULES_CREATE);
- if (!mods) {
- giterr_set(GITERR_SUBMODULE,
- "Adding submodules to a bare repository is not supported");
- return -1;
- }
-
- if ((error = git_buf_printf(&key, "submodule.%s.", submodule->name)) < 0)
- goto cleanup;
-
- /* save values for path, url, update, ignore, fetchRecurseSubmodules */
-
- if ((error = submodule_config_key_trunc_puts(&key, "path")) < 0 ||
- (error = git_config_file_set_string(mods, key.ptr, submodule->path)) < 0)
- goto cleanup;
-
- /* update internal defaults */
-
- submodule->ignore_default = submodule->ignore;
- submodule->update_default = submodule->update;
- submodule->fetch_recurse_default = submodule->fetch_recurse;
- submodule->flags |= GIT_SUBMODULE_STATUS_IN_CONFIG;
-
-cleanup:
- git_config_file_free(mods);
- git_buf_free(&key);
-
- return error;
-}
-
git_repository *git_submodule_owner(git_submodule *submodule)
{
assert(submodule);
diff --git a/tests/submodule/modify.c b/tests/submodule/modify.c
index 9c387a3..77f86e5 100644
--- a/tests/submodule/modify.c
+++ b/tests/submodule/modify.c
@@ -194,12 +194,3 @@ void test_submodule_modify__set_url(void)
cl_assert_equal_s(SM_LIBGIT2_URL, git_submodule_url(sm));
git_submodule_free(sm);
}
-
-void test_submodule_modify__save_last(void)
-{
- git_submodule *sm;
-
- cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_gitmodules_only"));
- cl_git_pass(git_submodule_save(sm));
- git_submodule_free(sm);
-}