submodule-config: make 'config_from_gitmodules' private

Now that 'config_from_gitmodules' is not used in the open, it can be marked as private. Hopefully this will prevent its usage for retrieving arbitrary configuration form the '.gitmodules' file. Signed-off-by: Antonio Ospite <ao2@ao2.it> Acked-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Antonio Ospite committed Jun 26, 2018 at 12:47 UTC 588929d54d110024fcce6b427e28a8a428a93d88
2 files changed +9 -11
submodule-config.c
+4 -4
@@ -673,14 +673,14 @@ void submodule_free(struct repository *r)
673 }
674
675 /*
676 - * Note: This function exists solely to maintain backward compatibility with
677 - * 'fetch' and 'update_clone' storing configuration in '.gitmodules' and should
678 - * NOT be used anywhere else.
676 + * Note: This function is private for a reason, the '.gitmodules' file should
677 + * not be used as as a mechanism to retrieve arbitrary configuration stored in
678 + * the repository.
679 *
680 * Runs the provided config function on the '.gitmodules' file found in the
681 * working directory.
682 */
683 -void config_from_gitmodules(config_fn_t fn, void *data)
683 +static void config_from_gitmodules(config_fn_t fn, void *data)
684 {
685 if (the_repository->worktree) {
686 char *file = repo_worktree_path(the_repository, GITMODULES_FILE);
submodule-config.h
+5 -7
@@ -57,15 +57,13 @@ void submodule_free(struct repository *r);
57 int check_submodule_name(const char *name);
58
59 /*
60 - * Note: This function exists solely to maintain backward compatibility with
61 - * 'fetch' and 'update_clone' storing configuration in '.gitmodules' and should
62 - * NOT be used anywhere else.
60 + * Note: these helper functions exist solely to maintain backward
61 + * compatibility with 'fetch' and 'update_clone' storing configuration in
62 + * '.gitmodules'.
63 *
64 - * Runs the provided config function on the '.gitmodules' file found in the
65 - * working directory.
64 + * New helpers to retrieve arbitrary configuration from the '.gitmodules' file
65 + * should NOT be added.
66 */
67 -extern void config_from_gitmodules(config_fn_t fn, void *data);
68 -
67 extern void fetch_config_from_gitmodules(int *max_children, int *recurse_submodules);
68 extern void update_clone_config_from_gitmodules(int *max_jobs);
69