git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org
Cc: jrnieder@gmail.com, sbeller@google.com,
	Brandon Williams <bmwill@google.com>
Subject: [PATCH 15/15] submodule: remove gitmodules_config
Date: Tue, 25 Jul 2017 14:39:28 -0700	[thread overview]
Message-ID: <20170725213928.125998-16-bmwill@google.com> (raw)
In-Reply-To: <20170725213928.125998-1-bmwill@google.com>

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>
---
 builtin/checkout.c               |  1 -
 builtin/commit.c                 |  1 -
 builtin/diff-files.c             |  1 -
 builtin/diff-index.c             |  1 -
 builtin/diff-tree.c              |  1 -
 builtin/diff.c                   |  2 --
 builtin/fetch.c                  |  4 ----
 builtin/grep.c                   |  4 ----
 builtin/mv.c                     |  1 -
 builtin/read-tree.c              |  2 --
 builtin/reset.c                  |  2 --
 builtin/rm.c                     |  1 -
 builtin/submodule--helper.c      | 14 --------------
 submodule.c                      | 15 ---------------
 submodule.h                      |  2 --
 t/helper/test-submodule-config.c |  1 -
 16 files changed, 53 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 246e0cd16..63ae16afc 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1179,7 +1179,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 	opts.prefix = prefix;
 	opts.show_progress = -1;
 
-	gitmodules_config();
 	git_config(git_checkout_config, &opts);
 
 	opts.track = BRANCH_TRACK_UNSPECIFIED;
diff --git a/builtin/commit.c b/builtin/commit.c
index 4bbac014a..18ad714d9 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -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)
 {
 	wt_status_prepare(s);
-	gitmodules_config();
 	git_config(fn, s);
 	determine_whence(s);
 	init_diff_ui_defaults();
diff --git a/builtin/diff-files.c b/builtin/diff-files.c
index 17bf84d18..e88493ffe 100644
--- a/builtin/diff-files.c
+++ b/builtin/diff-files.c
@@ -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 */
 	init_revisions(&rev, prefix);
-	gitmodules_config();
 	rev.abbrev = 0;
 	precompose_argv(argc, argv);
 
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 185e6f9b5..9d772f8f2 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -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 */
 	init_revisions(&rev, prefix);
-	gitmodules_config();
 	rev.abbrev = 0;
 	precompose_argv(argc, argv);
 
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 31d2cb410..d66499909 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -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 */
 	init_revisions(opt, prefix);
-	gitmodules_config();
 	opt->abbrev = 0;
 	opt->diff = 1;
 	opt->disable_stdin = 1;
diff --git a/builtin/diff.c b/builtin/diff.c
index 7cde6abbc..7e3ebcea3 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -315,8 +315,6 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 			no_index = DIFF_NO_INDEX_IMPLICIT;
 	}
 
-	if (!no_index)
-		gitmodules_config();
 	init_diff_ui_defaults();
 	git_config(git_diff_ui_config, NULL);
 	precompose_argv(argc, argv);
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 3fe99073d..132e3224e 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1360,10 +1360,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 	if (depth || deepen_since || deepen_not.nr)
 		deepen = 1;
 
-	if (recurse_submodules != RECURSE_SUBMODULES_OFF) {
-		gitmodules_config();
-	}
-
 	if (all) {
 		if (argc == 1)
 			die(_("fetch --all does not take a repository argument"));
diff --git a/builtin/grep.c b/builtin/grep.c
index ac06d2d33..2d65f27d0 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1048,10 +1048,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	}
 #endif
 
-	if (recurse_submodules) {
-		gitmodules_config();
-	}
-
 	if (show_in_pager && (cached || list.nr))
 		die(_("--open-files-in-pager only works on the worktree"));
 
diff --git a/builtin/mv.c b/builtin/mv.c
index 94fbaaa5d..ffdd5f01a 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -131,7 +131,6 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	struct stat st;
 	struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
 
-	gitmodules_config();
 	git_config(git_default_config, NULL);
 
 	argc = parse_options(argc, argv, prefix, builtin_mv_options,
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index d5f618d08..bf87a2710 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -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,
 			     read_tree_usage, 0);
 
-	load_submodule_cache();
-
 	hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
 
 	prefix_set = opts.prefix ? 1 : 0;
diff --git a/builtin/reset.c b/builtin/reset.c
index 772d078b8..50488d273 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -309,8 +309,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 						PARSE_OPT_KEEP_DASHDASH);
 	parse_args(&pathspec, argv, prefix, patch_mode, &rev);
 
-	load_submodule_cache();
-
 	unborn = !strcmp(rev, "HEAD") && get_oid("HEAD", &oid);
 	if (unborn) {
 		/* reset on unborn branch: treat as reset to empty tree */
diff --git a/builtin/rm.c b/builtin/rm.c
index 4057e73fa..d91451fea 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -255,7 +255,6 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 	struct pathspec pathspec;
 	char *seen;
 
-	gitmodules_config();
 	git_config(git_default_config, NULL);
 
 	argc = parse_options(argc, argv, prefix, builtin_rm_options,
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index c16249e30..d74855b2d 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -275,8 +275,6 @@ static void module_list_active(struct module_list *list)
 	int i;
 	struct module_list active_modules = MODULE_LIST_INIT;
 
-	gitmodules_config();
-
 	for (i = 0; i < list->nr; 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;
 	char *upd = NULL, *url = NULL, *displaypath;
 
-	/* Only loads from .gitmodules, no overlay with .git/config */
-	gitmodules_config();
-
 	if (prefix && get_super_prefix())
 		die("BUG: cannot have prefix and superprefix");
 	else if (prefix)
@@ -475,7 +470,6 @@ static int module_name(int argc, const char **argv, const char *prefix)
 	if (argc != 2)
 		usage(_("git submodule--helper name <path>"));
 
-	gitmodules_config();
 	sub = submodule_from_path(&null_oid, argv[1]);
 
 	if (!sub)
@@ -1033,8 +1027,6 @@ static int update_clone(int argc, const char **argv, const char *prefix)
 	if (pathspec.nr)
 		suc.warn_if_uninitialized = 1;
 
-	gitmodules_config();
-
 	run_processes_parallel(max_jobs,
 			       update_clone_get_next_task,
 			       update_clone_start_failure,
@@ -1075,8 +1067,6 @@ static const char *remote_submodule_branch(const char *path)
 	const char *branch = NULL;
 	char *key;
 
-	gitmodules_config();
-
 	sub = submodule_from_path(&null_oid, path);
 	if (!sub)
 		return NULL;
@@ -1195,8 +1185,6 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
 	argc = parse_options(argc, argv, prefix, embed_gitdir_options,
 			     git_submodule_helper_usage, 0);
 
-	gitmodules_config();
-
 	if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
 		return 1;
 
@@ -1212,8 +1200,6 @@ static int is_active(int argc, const char **argv, const char *prefix)
 	if (argc != 2)
 		die("submodule--helper is-active takes exactly 1 argument");
 
-	gitmodules_config();
-
 	return !is_submodule_active(the_repository, argv[1]);
 }
 
diff --git a/submodule.c b/submodule.c
index 7ebd639f4..1e4ff4e51 100644
--- a/submodule.c
+++ b/submodule.c
@@ -208,19 +208,6 @@ int option_parse_recurse_submodules_worktree_updater(const struct option *opt,
 	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'
  */
@@ -1109,7 +1096,6 @@ int submodule_touches_in_range(struct object_id *excl_oid,
 	struct argv_array args = ARGV_ARRAY_INIT;
 	int ret;
 
-	gitmodules_config();
 	/* No need to check if there are no submodules configured */
 	if (!submodule_from_path(NULL, NULL))
 		return 0;
@@ -2016,7 +2002,6 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule)
 		strbuf_addstr(buf, git_dir);
 	}
 	if (!is_git_directory(buf->buf)) {
-		gitmodules_config();
 		sub = submodule_from_path(&null_oid, submodule);
 		if (!sub) {
 			ret = -1;
diff --git a/submodule.h b/submodule.h
index 36fc7f7cf..7d0b5aa43 100644
--- a/submodule.h
+++ b/submodule.h
@@ -46,8 +46,6 @@ extern int git_default_submodule_config(const char *var, const char *value, void
 struct option;
 int option_parse_recurse_submodules_worktree_updater(const struct option *opt,
 						     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);
 /*
  * Determine if a submodule has been populated at a given 'path' by checking if
diff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c
index f4a7c431c..f23db3b19 100644
--- a/t/helper/test-submodule-config.c
+++ b/t/helper/test-submodule-config.c
@@ -32,7 +32,6 @@ int cmd_main(int argc, const char **argv)
 		die_usage(argc, argv, "Wrong number of arguments.");
 
 	setup_git_directory();
-	gitmodules_config();
 
 	while (*arg) {
 		struct object_id commit_oid;
-- 
2.14.0.rc0.400.g1c36432dff-goog


  parent reply	other threads:[~2017-07-25 21:40 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 21:39 [PATCH 00/15] submodule-config cleanup Brandon Williams
2017-07-25 21:39 ` [PATCH 01/15] t7411: check configuration parsing errors Brandon Williams
2017-07-26 20:56   ` Junio C Hamano
2017-07-25 21:39 ` [PATCH 02/15] submodule: don't use submodule_from_name Brandon Williams
2017-07-25 23:17   ` Stefan Beller
2017-07-26 21:06     ` Junio C Hamano
2017-07-30 13:43       ` Jens Lehmann
2017-07-30 21:25         ` Junio C Hamano
2017-07-31 20:43         ` Stefan Beller
2017-08-11 16:53           ` Heiko Voigt
2017-07-25 21:39 ` [PATCH 03/15] add, reset: ensure submodules can be added or reset Brandon Williams
2017-07-25 23:33   ` Stefan Beller
2017-07-25 23:37     ` Brandon Williams
2017-07-26 21:25     ` Junio C Hamano
2017-07-31 20:50       ` Brandon Williams
2017-07-25 21:39 ` [PATCH 04/15] submodule--helper: don't overlay config in remote_submodule_branch Brandon Williams
2017-07-25 23:35   ` Stefan Beller
2017-07-25 21:39 ` [PATCH 05/15] submodule--helper: don't overlay config in update-clone Brandon Williams
2017-07-25 23:37   ` Stefan Beller
2017-07-25 23:39     ` Brandon Williams
2017-07-25 21:39 ` [PATCH 06/15] fetch: don't overlay config with submodule-config Brandon Williams
2017-07-25 23:44   ` Stefan Beller
2017-07-25 23:48     ` Brandon Williams
2017-07-25 21:39 ` [PATCH 07/15] submodule: don't rely on overlayed config when setting diffopts Brandon Williams
2017-07-25 23:46   ` Stefan Beller
2017-07-25 21:39 ` [PATCH 08/15] unpack-trees: don't rely on overlayed config Brandon Williams
2017-07-25 21:39 ` [PATCH 09/15] submodule: remove submodule_config callback routine Brandon Williams
2017-07-26 21:31   ` Junio C Hamano
2017-07-25 21:39 ` [PATCH 10/15] diff: stop allowing diff to have submodules configured in .git/config Brandon Williams
2017-07-25 21:39 ` [PATCH 11/15] submodule-config: remove support for overlaying repository config Brandon Williams
2017-07-25 21:39 ` [PATCH 12/15] submodule-config: move submodule-config functions to submodule-config.c Brandon Williams
2017-07-25 21:39 ` [PATCH 13/15] submodule-config: lazy-load a repository's .gitmodules file Brandon Williams
2017-07-25 21:39 ` [PATCH 14/15] unpack-trees: improve loading of .gitmodules Brandon Williams
2017-07-25 21:39 ` Brandon Williams [this message]
2017-08-03 18:19 ` [PATCH v2 00/15] submodule-config cleanup Brandon Williams
2017-08-03 18:19   ` [PATCH v2 01/15] t7411: check configuration parsing errors Brandon Williams
2017-08-03 18:19   ` [PATCH v2 02/15] submodule: don't use submodule_from_name Brandon Williams
2017-08-03 18:57     ` Stefan Beller
2017-08-04 21:53       ` Brandon Williams
2017-08-11 16:59         ` Heiko Voigt
2017-08-03 20:17     ` Junio C Hamano
2017-08-03 18:19   ` [PATCH v2 03/15] add, reset: ensure submodules can be added or reset Brandon Williams
2017-08-03 18:19   ` [PATCH v2 04/15] submodule--helper: don't overlay config in remote_submodule_branch Brandon Williams
2017-08-03 18:19   ` [PATCH v2 05/15] submodule--helper: don't overlay config in update-clone Brandon Williams
2017-08-03 18:19   ` [PATCH v2 06/15] fetch: don't overlay config with submodule-config Brandon Williams
2017-08-03 18:19   ` [PATCH v2 07/15] submodule: don't rely on overlayed config when setting diffopts Brandon Williams
2017-08-03 18:19   ` [PATCH v2 08/15] unpack-trees: don't respect submodule.update Brandon Williams
2017-08-03 20:26     ` Stefan Beller
2017-08-03 20:37     ` Junio C Hamano
2017-08-03 20:43       ` Stefan Beller
2017-08-03 18:19   ` [PATCH v2 09/15] submodule: remove submodule_config callback routine Brandon Williams
2017-08-03 18:19   ` [PATCH v2 10/15] diff: stop allowing diff to have submodules configured in .git/config Brandon Williams
2017-08-03 20:40     ` Junio C Hamano
2017-08-04 21:59       ` Brandon Williams
2017-08-03 18:19   ` [PATCH v2 11/15] submodule-config: remove support for overlaying repository config Brandon Williams
2017-08-03 18:19   ` [PATCH v2 12/15] submodule-config: move submodule-config functions to submodule-config.c Brandon Williams
2017-08-03 18:19   ` [PATCH v2 13/15] submodule-config: lazy-load a repository's .gitmodules file Brandon Williams
2017-08-03 18:19   ` [PATCH v2 14/15] unpack-trees: improve loading of .gitmodules Brandon Williams
2017-08-11 17:18     ` Heiko Voigt
2017-08-03 18:20   ` [PATCH v2 15/15] submodule: remove gitmodules_config Brandon Williams
2017-08-03 20:09   ` [PATCH v2 00/15] submodule-config cleanup Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170725213928.125998-16-bmwill@google.com \
    --to=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).