submodule: remove gitmodules_config
Now that the submodule-config subsystem can lazily read the gitmodules file we no longer need to explicitly pre-read the gitmodules by calling 'gitmodules_config()' so let's remove it. 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:20 UTC
557a5998df19faf8641acfc5b6b1c3c2ba64dca9
16 files changed
-53
builtin/checkout.c
-1
@@ -1179,7 +1179,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
1179
opts.prefix = prefix;
1180
opts.show_progress = -1;
1181
1182
- gitmodules_config();
1182
git_config(git_checkout_config, &opts);
1183
1184
opts.track = BRANCH_TRACK_UNSPECIFIED;
builtin/commit.c
-1
@@ -195,7 +195,6 @@ static void determine_whence(struct wt_status *s)
195
static void status_init_config(struct wt_status *s, config_fn_t fn)
196
{
197
wt_status_prepare(s);
198
- gitmodules_config();
198
git_config(fn, s);
199
determine_whence(s);
200
init_diff_ui_defaults();
builtin/diff-files.c
-1
@@ -26,7 +26,6 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
26
27
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
28
init_revisions(&rev, prefix);
29
- gitmodules_config();
29
rev.abbrev = 0;
30
precompose_argv(argc, argv);
31
builtin/diff-index.c
-1
@@ -23,7 +23,6 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
23
24
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
25
init_revisions(&rev, prefix);
26
- gitmodules_config();
26
rev.abbrev = 0;
27
precompose_argv(argc, argv);
28
builtin/diff-tree.c
-1
@@ -110,7 +110,6 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
110
111
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
112
init_revisions(opt, prefix);
113
- gitmodules_config();
113
opt->abbrev = 0;
114
opt->diff = 1;
115
opt->disable_stdin = 1;
builtin/diff.c
-2
@@ -315,8 +315,6 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
315
no_index = DIFF_NO_INDEX_IMPLICIT;
316
}
317
318
- if (!no_index)
319
- gitmodules_config();
318
init_diff_ui_defaults();
319
git_config(git_diff_ui_config, NULL);
320
precompose_argv(argc, argv);
builtin/fetch.c
-4
@@ -1360,10 +1360,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
1360
if (depth || deepen_since || deepen_not.nr)
1361
deepen = 1;
1362
1363
- if (recurse_submodules != RECURSE_SUBMODULES_OFF) {
1364
- gitmodules_config();
1365
- }
1366
-
1363
if (all) {
1364
if (argc == 1)
1365
die(_("fetch --all does not take a repository argument"));
builtin/grep.c
-4
@@ -1048,10 +1048,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
1048
}
1049
#endif
1050
1051
- if (recurse_submodules) {
1052
- gitmodules_config();
1053
- }
1054
-
1051
if (show_in_pager && (cached || list.nr))
1052
die(_("--open-files-in-pager only works on the worktree"));
1053
builtin/mv.c
-1
@@ -131,7 +131,6 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
131
struct stat st;
132
struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
133
134
- gitmodules_config();
134
git_config(git_default_config, NULL);
135
136
argc = parse_options(argc, argv, prefix, builtin_mv_options,
builtin/read-tree.c
-2
@@ -164,8 +164,6 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
164
argc = parse_options(argc, argv, unused_prefix, read_tree_options,
165
read_tree_usage, 0);
166
167
- load_submodule_cache();
168
-
167
hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
168
169
prefix_set = opts.prefix ? 1 : 0;
builtin/reset.c
-2
@@ -309,8 +309,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
309
PARSE_OPT_KEEP_DASHDASH);
310
parse_args(&pathspec, argv, prefix, patch_mode, &rev);
311
312
- load_submodule_cache();
313
-
312
unborn = !strcmp(rev, "HEAD") && get_oid("HEAD", &oid);
313
if (unborn) {
314
/* reset on unborn branch: treat as reset to empty tree */
builtin/rm.c
-1
@@ -255,7 +255,6 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
255
struct pathspec pathspec;
256
char *seen;
257
258
- gitmodules_config();
258
git_config(git_default_config, NULL);
259
260
argc = parse_options(argc, argv, prefix, builtin_rm_options,
builtin/submodule--helper.c
-14
@@ -275,8 +275,6 @@ static void module_list_active(struct module_list *list)
275
int i;
276
struct module_list active_modules = MODULE_LIST_INIT;
277
278
- gitmodules_config();
279
-
278
for (i = 0; i < list->nr; i++) {
279
const struct cache_entry *ce = list->entries[i];
280
@@ -337,9 +335,6 @@ static void init_submodule(const char *path, const char *prefix, int quiet)
335
struct strbuf sb = STRBUF_INIT;
336
char *upd = NULL, *url = NULL, *displaypath;
337
340
- /* Only loads from .gitmodules, no overlay with .git/config */
341
- gitmodules_config();
342
-
338
if (prefix && get_super_prefix())
339
die("BUG: cannot have prefix and superprefix");
340
else if (prefix)
@@ -475,7 +470,6 @@ static int module_name(int argc, const char **argv, const char *prefix)
470
if (argc != 2)
471
usage(_("git submodule--helper name <path>"));
472
478
- gitmodules_config();
473
sub = submodule_from_path(&null_oid, argv[1]);
474
475
if (!sub)
@@ -1042,8 +1036,6 @@ static int update_clone(int argc, const char **argv, const char *prefix)
1036
if (pathspec.nr)
1037
suc.warn_if_uninitialized = 1;
1038
1045
- gitmodules_config();
1046
-
1039
run_processes_parallel(max_jobs,
1040
update_clone_get_next_task,
1041
update_clone_start_failure,
@@ -1084,8 +1076,6 @@ static const char *remote_submodule_branch(const char *path)
1076
const char *branch = NULL;
1077
char *key;
1078
1087
- gitmodules_config();
1088
-
1079
sub = submodule_from_path(&null_oid, path);
1080
if (!sub)
1081
return NULL;
@@ -1204,8 +1194,6 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
1194
argc = parse_options(argc, argv, prefix, embed_gitdir_options,
1195
git_submodule_helper_usage, 0);
1196
1207
- gitmodules_config();
1208
-
1197
if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
1198
return 1;
1199
@@ -1221,8 +1209,6 @@ static int is_active(int argc, const char **argv, const char *prefix)
1209
if (argc != 2)
1210
die("submodule--helper is-active takes exactly 1 argument");
1211
1224
- gitmodules_config();
1225
-
1212
return !is_submodule_active(the_repository, argv[1]);
1213
}
1214
submodule.c
-15
@@ -208,19 +208,6 @@ int option_parse_recurse_submodules_worktree_updater(const struct option *opt,
208
return 0;
209
}
210
211
-void load_submodule_cache(void)
212
-{
213
- if (config_update_recurse_submodules == RECURSE_SUBMODULES_OFF)
214
- return;
215
-
216
- gitmodules_config();
217
-}
218
-
219
-void gitmodules_config(void)
220
-{
221
- repo_read_gitmodules(the_repository);
222
-}
223
-
211
/*
212
* Determine if a submodule has been initialized at a given 'path'
213
*/
@@ -1093,7 +1080,6 @@ int submodule_touches_in_range(struct object_id *excl_oid,
1080
struct argv_array args = ARGV_ARRAY_INIT;
1081
int ret;
1082
1096
- gitmodules_config();
1083
/* No need to check if there are no submodules configured */
1084
if (!submodule_from_path(NULL, NULL))
1085
return 0;
@@ -2000,7 +1986,6 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule)
1986
strbuf_addstr(buf, git_dir);
1987
}
1988
if (!is_git_directory(buf->buf)) {
2003
- gitmodules_config();
1989
sub = submodule_from_path(&null_oid, submodule);
1990
if (!sub) {
1991
ret = -1;
submodule.h
-2
@@ -45,8 +45,6 @@ extern int git_default_submodule_config(const char *var, const char *value, void
45
struct option;
46
int option_parse_recurse_submodules_worktree_updater(const struct option *opt,
47
const char *arg, int unset);
48
-void load_submodule_cache(void);
49
-extern void gitmodules_config(void);
48
extern int is_submodule_active(struct repository *repo, const char *path);
49
/*
50
* Determine if a submodule has been populated at a given 'path' by checking if
t/helper/test-submodule-config.c
-1
@@ -32,7 +32,6 @@ int cmd_main(int argc, const char **argv)
32
die_usage(argc, argv, "Wrong number of arguments.");
33
34
setup_git_directory();
35
- gitmodules_config();
35
36
while (*arg) {
37
struct object_id commit_oid;