Skip to content

Commit 2cc67fe

Browse files
bmwillgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7463e2e commit 2cc67fe

File tree

3 files changed

+2
-25
lines changed

3 files changed

+2
-25
lines changed

builtin/submodule--helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,6 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
12051205
git_submodule_helper_usage, 0);
12061206

12071207
gitmodules_config();
1208-
git_config(submodule_config, NULL);
12091208

12101209
if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
12111210
return 1;

submodule.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -180,27 +180,6 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
180180
}
181181
}
182182

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-
204183
/* Cheap function that only determines if we're interested in submodules at all */
205184
int git_default_submodule_config(const char *var, const char *value, void *cb)
206185
{
@@ -271,8 +250,8 @@ void gitmodules_config_oid(const struct object_id *commit_oid)
271250
struct object_id oid;
272251

273252
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);
276255
}
277256
strbuf_release(&rev);
278257
}

submodule.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ extern int remove_path_from_gitmodules(const char *path);
4040
extern void stage_updated_gitmodules(void);
4141
extern void set_diffopt_flags_from_submodule_config(struct diff_options *,
4242
const char *path);
43-
extern int submodule_config(const char *var, const char *value, void *cb);
4443
extern int git_default_submodule_config(const char *var, const char *value, void *cb);
4544

4645
struct option;

0 commit comments

Comments
 (0)