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>maint
							parent
							
								
									3302871320
								
							
						
					
					
						commit
						557a5998df
					
				|  | @ -1179,7 +1179,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) | ||||||
| 	opts.prefix = prefix; | 	opts.prefix = prefix; | ||||||
| 	opts.show_progress = -1; | 	opts.show_progress = -1; | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
| 	git_config(git_checkout_config, &opts); | 	git_config(git_checkout_config, &opts); | ||||||
|  |  | ||||||
| 	opts.track = BRANCH_TRACK_UNSPECIFIED; | 	opts.track = BRANCH_TRACK_UNSPECIFIED; | ||||||
|  |  | ||||||
|  | @ -195,7 +195,6 @@ static void determine_whence(struct wt_status *s) | ||||||
| static void status_init_config(struct wt_status *s, config_fn_t fn) | static void status_init_config(struct wt_status *s, config_fn_t fn) | ||||||
| { | { | ||||||
| 	wt_status_prepare(s); | 	wt_status_prepare(s); | ||||||
| 	gitmodules_config(); |  | ||||||
| 	git_config(fn, s); | 	git_config(fn, s); | ||||||
| 	determine_whence(s); | 	determine_whence(s); | ||||||
| 	init_diff_ui_defaults(); | 	init_diff_ui_defaults(); | ||||||
|  |  | ||||||
|  | @ -26,7 +26,6 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix) | ||||||
|  |  | ||||||
| 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ | 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ | ||||||
| 	init_revisions(&rev, prefix); | 	init_revisions(&rev, prefix); | ||||||
| 	gitmodules_config(); |  | ||||||
| 	rev.abbrev = 0; | 	rev.abbrev = 0; | ||||||
| 	precompose_argv(argc, argv); | 	precompose_argv(argc, argv); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @ -23,7 +23,6 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix) | ||||||
|  |  | ||||||
| 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ | 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ | ||||||
| 	init_revisions(&rev, prefix); | 	init_revisions(&rev, prefix); | ||||||
| 	gitmodules_config(); |  | ||||||
| 	rev.abbrev = 0; | 	rev.abbrev = 0; | ||||||
| 	precompose_argv(argc, argv); | 	precompose_argv(argc, argv); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @ -110,7 +110,6 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix) | ||||||
|  |  | ||||||
| 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ | 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ | ||||||
| 	init_revisions(opt, prefix); | 	init_revisions(opt, prefix); | ||||||
| 	gitmodules_config(); |  | ||||||
| 	opt->abbrev = 0; | 	opt->abbrev = 0; | ||||||
| 	opt->diff = 1; | 	opt->diff = 1; | ||||||
| 	opt->disable_stdin = 1; | 	opt->disable_stdin = 1; | ||||||
|  |  | ||||||
|  | @ -315,8 +315,6 @@ int cmd_diff(int argc, const char **argv, const char *prefix) | ||||||
| 			no_index = DIFF_NO_INDEX_IMPLICIT; | 			no_index = DIFF_NO_INDEX_IMPLICIT; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (!no_index) |  | ||||||
| 		gitmodules_config(); |  | ||||||
| 	init_diff_ui_defaults(); | 	init_diff_ui_defaults(); | ||||||
| 	git_config(git_diff_ui_config, NULL); | 	git_config(git_diff_ui_config, NULL); | ||||||
| 	precompose_argv(argc, argv); | 	precompose_argv(argc, argv); | ||||||
|  |  | ||||||
|  | @ -1360,10 +1360,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) | ||||||
| 	if (depth || deepen_since || deepen_not.nr) | 	if (depth || deepen_since || deepen_not.nr) | ||||||
| 		deepen = 1; | 		deepen = 1; | ||||||
|  |  | ||||||
| 	if (recurse_submodules != RECURSE_SUBMODULES_OFF) { |  | ||||||
| 		gitmodules_config(); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (all) { | 	if (all) { | ||||||
| 		if (argc == 1) | 		if (argc == 1) | ||||||
| 			die(_("fetch --all does not take a repository argument")); | 			die(_("fetch --all does not take a repository argument")); | ||||||
|  |  | ||||||
|  | @ -1048,10 +1048,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix) | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| 	if (recurse_submodules) { |  | ||||||
| 		gitmodules_config(); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (show_in_pager && (cached || list.nr)) | 	if (show_in_pager && (cached || list.nr)) | ||||||
| 		die(_("--open-files-in-pager only works on the worktree")); | 		die(_("--open-files-in-pager only works on the worktree")); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @ -131,7 +131,6 @@ int cmd_mv(int argc, const char **argv, const char *prefix) | ||||||
| 	struct stat st; | 	struct stat st; | ||||||
| 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP; | 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP; | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
| 	git_config(git_default_config, NULL); | 	git_config(git_default_config, NULL); | ||||||
|  |  | ||||||
| 	argc = parse_options(argc, argv, prefix, builtin_mv_options, | 	argc = parse_options(argc, argv, prefix, builtin_mv_options, | ||||||
|  |  | ||||||
|  | @ -164,8 +164,6 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) | ||||||
| 	argc = parse_options(argc, argv, unused_prefix, read_tree_options, | 	argc = parse_options(argc, argv, unused_prefix, read_tree_options, | ||||||
| 			     read_tree_usage, 0); | 			     read_tree_usage, 0); | ||||||
|  |  | ||||||
| 	load_submodule_cache(); |  | ||||||
|  |  | ||||||
| 	hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR); | 	hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR); | ||||||
|  |  | ||||||
| 	prefix_set = opts.prefix ? 1 : 0; | 	prefix_set = opts.prefix ? 1 : 0; | ||||||
|  |  | ||||||
|  | @ -309,8 +309,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix) | ||||||
| 						PARSE_OPT_KEEP_DASHDASH); | 						PARSE_OPT_KEEP_DASHDASH); | ||||||
| 	parse_args(&pathspec, argv, prefix, patch_mode, &rev); | 	parse_args(&pathspec, argv, prefix, patch_mode, &rev); | ||||||
|  |  | ||||||
| 	load_submodule_cache(); |  | ||||||
|  |  | ||||||
| 	unborn = !strcmp(rev, "HEAD") && get_oid("HEAD", &oid); | 	unborn = !strcmp(rev, "HEAD") && get_oid("HEAD", &oid); | ||||||
| 	if (unborn) { | 	if (unborn) { | ||||||
| 		/* reset on unborn branch: treat as reset to empty tree */ | 		/* reset on unborn branch: treat as reset to empty tree */ | ||||||
|  |  | ||||||
|  | @ -255,7 +255,6 @@ int cmd_rm(int argc, const char **argv, const char *prefix) | ||||||
| 	struct pathspec pathspec; | 	struct pathspec pathspec; | ||||||
| 	char *seen; | 	char *seen; | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
| 	git_config(git_default_config, NULL); | 	git_config(git_default_config, NULL); | ||||||
|  |  | ||||||
| 	argc = parse_options(argc, argv, prefix, builtin_rm_options, | 	argc = parse_options(argc, argv, prefix, builtin_rm_options, | ||||||
|  |  | ||||||
|  | @ -275,8 +275,6 @@ static void module_list_active(struct module_list *list) | ||||||
| 	int i; | 	int i; | ||||||
| 	struct module_list active_modules = MODULE_LIST_INIT; | 	struct module_list active_modules = MODULE_LIST_INIT; | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
|  |  | ||||||
| 	for (i = 0; i < list->nr; i++) { | 	for (i = 0; i < list->nr; i++) { | ||||||
| 		const struct cache_entry *ce = list->entries[i]; | 		const struct cache_entry *ce = list->entries[i]; | ||||||
|  |  | ||||||
|  | @ -337,9 +335,6 @@ static void init_submodule(const char *path, const char *prefix, int quiet) | ||||||
| 	struct strbuf sb = STRBUF_INIT; | 	struct strbuf sb = STRBUF_INIT; | ||||||
| 	char *upd = NULL, *url = NULL, *displaypath; | 	char *upd = NULL, *url = NULL, *displaypath; | ||||||
|  |  | ||||||
| 	/* Only loads from .gitmodules, no overlay with .git/config */ |  | ||||||
| 	gitmodules_config(); |  | ||||||
|  |  | ||||||
| 	if (prefix && get_super_prefix()) | 	if (prefix && get_super_prefix()) | ||||||
| 		die("BUG: cannot have prefix and superprefix"); | 		die("BUG: cannot have prefix and superprefix"); | ||||||
| 	else if (prefix) | 	else if (prefix) | ||||||
|  | @ -475,7 +470,6 @@ static int module_name(int argc, const char **argv, const char *prefix) | ||||||
| 	if (argc != 2) | 	if (argc != 2) | ||||||
| 		usage(_("git submodule--helper name <path>")); | 		usage(_("git submodule--helper name <path>")); | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
| 	sub = submodule_from_path(&null_oid, argv[1]); | 	sub = submodule_from_path(&null_oid, argv[1]); | ||||||
|  |  | ||||||
| 	if (!sub) | 	if (!sub) | ||||||
|  | @ -1042,8 +1036,6 @@ static int update_clone(int argc, const char **argv, const char *prefix) | ||||||
| 	if (pathspec.nr) | 	if (pathspec.nr) | ||||||
| 		suc.warn_if_uninitialized = 1; | 		suc.warn_if_uninitialized = 1; | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
|  |  | ||||||
| 	run_processes_parallel(max_jobs, | 	run_processes_parallel(max_jobs, | ||||||
| 			       update_clone_get_next_task, | 			       update_clone_get_next_task, | ||||||
| 			       update_clone_start_failure, | 			       update_clone_start_failure, | ||||||
|  | @ -1084,8 +1076,6 @@ static const char *remote_submodule_branch(const char *path) | ||||||
| 	const char *branch = NULL; | 	const char *branch = NULL; | ||||||
| 	char *key; | 	char *key; | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
|  |  | ||||||
| 	sub = submodule_from_path(&null_oid, path); | 	sub = submodule_from_path(&null_oid, path); | ||||||
| 	if (!sub) | 	if (!sub) | ||||||
| 		return NULL; | 		return NULL; | ||||||
|  | @ -1204,8 +1194,6 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix) | ||||||
| 	argc = parse_options(argc, argv, prefix, embed_gitdir_options, | 	argc = parse_options(argc, argv, prefix, embed_gitdir_options, | ||||||
| 			     git_submodule_helper_usage, 0); | 			     git_submodule_helper_usage, 0); | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
|  |  | ||||||
| 	if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0) | 	if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0) | ||||||
| 		return 1; | 		return 1; | ||||||
|  |  | ||||||
|  | @ -1221,8 +1209,6 @@ static int is_active(int argc, const char **argv, const char *prefix) | ||||||
| 	if (argc != 2) | 	if (argc != 2) | ||||||
| 		die("submodule--helper is-active takes exactly 1 argument"); | 		die("submodule--helper is-active takes exactly 1 argument"); | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
|  |  | ||||||
| 	return !is_submodule_active(the_repository, argv[1]); | 	return !is_submodule_active(the_repository, argv[1]); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										15
									
								
								submodule.c
								
								
								
								
							
							
						
						
									
										15
									
								
								submodule.c
								
								
								
								
							|  | @ -208,19 +208,6 @@ int option_parse_recurse_submodules_worktree_updater(const struct option *opt, | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| void load_submodule_cache(void) |  | ||||||
| { |  | ||||||
| 	if (config_update_recurse_submodules == RECURSE_SUBMODULES_OFF) |  | ||||||
| 		return; |  | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void gitmodules_config(void) |  | ||||||
| { |  | ||||||
| 	repo_read_gitmodules(the_repository); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Determine if a submodule has been initialized at a given 'path' |  * Determine if a submodule has been initialized at a given 'path' | ||||||
|  */ |  */ | ||||||
|  | @ -1093,7 +1080,6 @@ int submodule_touches_in_range(struct object_id *excl_oid, | ||||||
| 	struct argv_array args = ARGV_ARRAY_INIT; | 	struct argv_array args = ARGV_ARRAY_INIT; | ||||||
| 	int ret; | 	int ret; | ||||||
|  |  | ||||||
| 	gitmodules_config(); |  | ||||||
| 	/* No need to check if there are no submodules configured */ | 	/* No need to check if there are no submodules configured */ | ||||||
| 	if (!submodule_from_path(NULL, NULL)) | 	if (!submodule_from_path(NULL, NULL)) | ||||||
| 		return 0; | 		return 0; | ||||||
|  | @ -2000,7 +1986,6 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule) | ||||||
| 		strbuf_addstr(buf, git_dir); | 		strbuf_addstr(buf, git_dir); | ||||||
| 	} | 	} | ||||||
| 	if (!is_git_directory(buf->buf)) { | 	if (!is_git_directory(buf->buf)) { | ||||||
| 		gitmodules_config(); |  | ||||||
| 		sub = submodule_from_path(&null_oid, submodule); | 		sub = submodule_from_path(&null_oid, submodule); | ||||||
| 		if (!sub) { | 		if (!sub) { | ||||||
| 			ret = -1; | 			ret = -1; | ||||||
|  |  | ||||||
|  | @ -45,8 +45,6 @@ extern int git_default_submodule_config(const char *var, const char *value, void | ||||||
| struct option; | struct option; | ||||||
| int option_parse_recurse_submodules_worktree_updater(const struct option *opt, | int option_parse_recurse_submodules_worktree_updater(const struct option *opt, | ||||||
| 						     const char *arg, int unset); | 						     const char *arg, int unset); | ||||||
| void load_submodule_cache(void); |  | ||||||
| extern void gitmodules_config(void); |  | ||||||
| extern int is_submodule_active(struct repository *repo, const char *path); | extern int is_submodule_active(struct repository *repo, const char *path); | ||||||
| /* | /* | ||||||
|  * Determine if a submodule has been populated at a given 'path' by checking if |  * Determine if a submodule has been populated at a given 'path' by checking if | ||||||
|  |  | ||||||
|  | @ -32,7 +32,6 @@ int cmd_main(int argc, const char **argv) | ||||||
| 		die_usage(argc, argv, "Wrong number of arguments."); | 		die_usage(argc, argv, "Wrong number of arguments."); | ||||||
|  |  | ||||||
| 	setup_git_directory(); | 	setup_git_directory(); | ||||||
| 	gitmodules_config(); |  | ||||||
|  |  | ||||||
| 	while (*arg) { | 	while (*arg) { | ||||||
| 		struct object_id commit_oid; | 		struct object_id commit_oid; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Brandon Williams
						Brandon Williams