submodule: remove submodule_config callback routine

Remove the last remaining caller of 'submodule_config()' as well as the function itself. With 'submodule_config()' being removed the submodule-config API can be a little simpler as callers don't need to worry about whether or not they need to overlay the repository's config on top of the submodule-config. This also makes it more difficult to accidentally add non-submodule specific configuration to the .gitmodules file. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed Aug 3, 2017 at 11:19 UTC 2cc67fe54a029842e71e49a676bf010e988d4063
3 files changed +2 -25
builtin/submodule--helper.c
-1
@@ -1205,7 +1205,6 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
1205 git_submodule_helper_usage, 0);
1206
1207 gitmodules_config();
1208 - git_config(submodule_config, NULL);
1208
1209 if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
1210 return 1;
submodule.c
+2 -23
@@ -180,27 +180,6 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
180 }
181 }
182
183 -/* For loading from the .gitmodules file. */
184 -static int git_modules_config(const char *var, const char *value, void *cb)
185 -{
186 - if (starts_with(var, "submodule."))
187 - return parse_submodule_config_option(var, value);
188 - return 0;
189 -}
190 -
191 -/* Loads all submodule settings from the config. */
192 -int submodule_config(const char *var, const char *value, void *cb)
193 -{
194 - if (!strcmp(var, "submodule.recurse")) {
195 - int v = git_config_bool(var, value) ?
196 - RECURSE_SUBMODULES_ON : RECURSE_SUBMODULES_OFF;
197 - config_update_recurse_submodules = v;
198 - return 0;
199 - } else {
200 - return git_modules_config(var, value, cb);
201 - }
202 -}
203 -
183 /* Cheap function that only determines if we're interested in submodules at all */
184 int git_default_submodule_config(const char *var, const char *value, void *cb)
185 {
@@ -271,8 +250,8 @@ void gitmodules_config_oid(const struct object_id *commit_oid)
250 struct object_id oid;
251
252 if (gitmodule_oid_from_commit(commit_oid, &oid, &rev)) {
274 - git_config_from_blob_oid(submodule_config, rev.buf,
275 - &oid, NULL);
253 + git_config_from_blob_oid(gitmodules_cb, rev.buf,
254 + &oid, the_repository);
255 }
256 strbuf_release(&rev);
257 }
submodule.h
-1
@@ -40,7 +40,6 @@ extern int remove_path_from_gitmodules(const char *path);
40 extern void stage_updated_gitmodules(void);
41 extern void set_diffopt_flags_from_submodule_config(struct diff_options *,
42 const char *path);
43 -extern int submodule_config(const char *var, const char *value, void *cb);
43 extern int git_default_submodule_config(const char *var, const char *value, void *cb);
44
45 struct option;