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>
This commit is contained in:
Brandon Williams 2017-08-03 11:19:54 -07:00 committed by Junio C Hamano
parent 7463e2ec3e
commit 2cc67fe54a
3 changed files with 2 additions and 25 deletions

View File

@ -1205,7 +1205,6 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
git_submodule_helper_usage, 0); git_submodule_helper_usage, 0);
gitmodules_config(); gitmodules_config();
git_config(submodule_config, NULL);
if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0) if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
return 1; return 1;

View File

@ -180,27 +180,6 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
} }
} }
/* For loading from the .gitmodules file. */
static int git_modules_config(const char *var, const char *value, void *cb)
{
if (starts_with(var, "submodule."))
return parse_submodule_config_option(var, value);
return 0;
}
/* Loads all submodule settings from the config. */
int submodule_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "submodule.recurse")) {
int v = git_config_bool(var, value) ?
RECURSE_SUBMODULES_ON : RECURSE_SUBMODULES_OFF;
config_update_recurse_submodules = v;
return 0;
} else {
return git_modules_config(var, value, cb);
}
}
/* Cheap function that only determines if we're interested in submodules at all */ /* Cheap function that only determines if we're interested in submodules at all */
int git_default_submodule_config(const char *var, const char *value, void *cb) int git_default_submodule_config(const char *var, const char *value, void *cb)
{ {
@ -271,8 +250,8 @@ void gitmodules_config_oid(const struct object_id *commit_oid)
struct object_id oid; struct object_id oid;
if (gitmodule_oid_from_commit(commit_oid, &oid, &rev)) { if (gitmodule_oid_from_commit(commit_oid, &oid, &rev)) {
git_config_from_blob_oid(submodule_config, rev.buf, git_config_from_blob_oid(gitmodules_cb, rev.buf,
&oid, NULL); &oid, the_repository);
} }
strbuf_release(&rev); strbuf_release(&rev);
} }

View File

@ -40,7 +40,6 @@ extern int remove_path_from_gitmodules(const char *path);
extern void stage_updated_gitmodules(void); extern void stage_updated_gitmodules(void);
extern void set_diffopt_flags_from_submodule_config(struct diff_options *, extern void set_diffopt_flags_from_submodule_config(struct diff_options *,
const char *path); const char *path);
extern int submodule_config(const char *var, const char *value, void *cb);
extern int git_default_submodule_config(const char *var, const char *value, void *cb); extern int git_default_submodule_config(const char *var, const char *value, void *cb);
struct option; struct option;