git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/5] submodule-config: remove submodule_from_cache

From
Stefan Beller <sbeller@google.com>
Date
Mar 27, 2018, 21:39 UTC
Message-ID
<20180327213918.77851-5-sbeller@google.com>
In-Reply-To
<20180327213918.77851-1-sbeller@google.com>

This continues the story of bf12fcdf5e (submodule-config: store the_submodule_cache in the_repository, 2017-06-22).

The previous patch taught submodule_from_path to take a repository into account, such that submodule_from_{path, cache} are the same now. Remove submodule_from_cache, migrating all its callers to submodule_from_path.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 repository.c       | 2 +-
 submodule-config.c | 9 ---------
 submodule-config.h | 3 ---
 submodule.c        | 4 ++--
 4 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/repository.c b/repository.c
index 4ffbe9bc94..fa0a132e22 100644
--- a/repository.c
+++ b/repository.c
@@ -167,7 +167,7 @@ int repo_submodule_init(struct repository *submodule,
 	struct strbuf worktree = STRBUF_INIT;
 	int ret = 0;
 
-	sub = submodule_from_cache(superproject, &null_oid, path);
+	sub = submodule_from_path(superproject, &null_oid, path);
 	if (!sub) {
 		ret = -1;
 		goto out;
diff --git a/submodule-config.c b/submodule-config.c
index 4b7803e6ed..cb65354d4c 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -635,15 +635,6 @@ const struct submodule *submodule_from_path(struct repository *r,
 	return config_from(r->submodule_cache, treeish_name, path, lookup_path);
 }
 
-const struct submodule *submodule_from_cache(struct repository *repo,
-					     const struct object_id *treeish_name,
-					     const char *key)
-{
-	gitmodules_read_check(repo);
-	return config_from(repo->submodule_cache, treeish_name,
-			   key, lookup_path);
-}
-
 void submodule_free(struct repository *r)
 {
 	if (r->submodule_cache)
diff --git a/submodule-config.h b/submodule-config.h
index ff3c9e0b5c..3ae8a1e51b 100644
--- a/submodule-config.h
+++ b/submodule-config.h
@@ -43,9 +43,6 @@ extern const struct submodule *submodule_from_name(struct repository *r,
 		const struct object_id *commit_or_tree, const char *name);
 extern const struct submodule *submodule_from_path(struct repository *r,
 		const struct object_id *commit_or_tree, const char *path);
-extern const struct submodule *submodule_from_cache(struct repository *repo,
-						    const struct object_id *treeish_name,
-						    const char *key);
 extern void submodule_free(struct repository *r);
 
 #endif /* SUBMODULE_CONFIG_H */
diff --git a/submodule.c b/submodule.c
index e94b7f9acd..89d0aee086 100644
--- a/submodule.c
+++ b/submodule.c
@@ -230,7 +230,7 @@ int is_submodule_active(struct repository *repo, const char *path)
 	const struct string_list *sl;
 	const struct submodule *module;
 
-	module = submodule_from_cache(repo, &null_oid, path);
+	module = submodule_from_path(repo, &null_oid, path);
 
 	/* early return if there isn't a path->module mapping */
 	if (!module)
@@ -1235,7 +1235,7 @@ static int get_next_submodule(struct child_process *cp,
 		if (!S_ISGITLINK(ce->ce_mode))
 			continue;
 
-		submodule = submodule_from_cache(spf->r, &null_oid, ce->name);
+		submodule = submodule_from_path(spf->r, &null_oid, ce->name);
 		if (!submodule) {
 			const char *name = default_name_or_path(ce->name);
 			if (name) {
-- 
2.17.0.rc1.321.gba9d0f2565-goog
Previous: Jonathan TanNext: Jonathan Tan
Message 35 of 36 in “Moving submodules with nested submodules”
  1. 0/5 Moving submodules with nested submodulesStefan Beller, Mar 27, 2018
  2. 1/5 submodule.h: drop declaration of connect_work_tree_and_git_dirStefan Beller, Mar 27, 2018
  3. 3/5 submodule-config: add repository argument to submodule_from_{name, path}Stefan Beller, Mar 27, 2018
  4. Jonathan TanMar 27, 2018
  5. Stefan BellerMar 27, 2018
  6. 2/5 submodule-config: allow submodule_free to handle arbitrary repositoriesStefan Beller, Mar 27, 2018
  7. Brandon WilliamsMar 27, 2018
  8. grep: remove "repo" arg from non-supporting funcsJonathan Tan, Mar 27, 2018
  9. Stefan BellerMar 27, 2018
  10. Jonathan TanMar 28, 2018
  11. Stefan BellerMar 28, 2018
  12. 5/5 submodule: fixup nested submodules after moving the submoduleStefan Beller, Mar 27, 2018
  13. Brandon WilliamsMar 27, 2018
  14. Jonathan TanMar 28, 2018
  15. Stefan BellerMar 28, 2018
  16. 0/6 Moving submodules with nested submodulesStefan Beller, Mar 28, 2018
  17. 1/6 submodule.h: drop declaration of connect_work_tree_and_git_dirStefan Beller, Mar 28, 2018
  18. 2/6 submodule-config: allow submodule_free to handle arbitrary repositoriesStefan Beller, Mar 28, 2018
  19. 4/6 submodule-config: remove submodule_from_cacheStefan Beller, Mar 28, 2018
  20. 5/6 submodule: fixup nested submodules after moving the submoduleStefan Beller, Mar 28, 2018
  21. Brandon WilliamsMar 28, 2018
  22. Stefan BellerMar 28, 2018
  23. Jonathan TanMar 28, 2018
  24. 3/6 submodule-config: add repository argument to submodule_from_{name, path}Stefan Beller, Mar 28, 2018
  25. 6/6 grep: remove "repo" arg from non-supporting funcsStefan Beller, Mar 28, 2018
  26. Jonathan TanMar 28, 2018
  27. 0/6 Moving submodules with nested submodulesStefan Beller, Mar 28, 2018
  28. 1/6 submodule.h: drop declaration of connect_work_tree_and_git_dirStefan Beller, Mar 28, 2018
  29. 2/6 grep: remove "repo" arg from non-supporting funcsStefan Beller, Mar 28, 2018
  30. 3/6 submodule-config: allow submodule_free to handle arbitrary repositoriesStefan Beller, Mar 28, 2018
  31. 6/6 submodule: fixup nested submodules after moving the submoduleStefan Beller, Mar 28, 2018
  32. 4/6 submodule-config: add repository argument to submodule_from_{name, path}Stefan Beller, Mar 28, 2018
  33. 5/6 submodule-config: remove submodule_from_cacheStefan Beller, Mar 28, 2018
  34. Jonathan TanMar 28, 2018
  35. 4/5 submodule-config: remove submodule_from_cacheStefan Beller, Mar 27, 2018
  36. Jonathan TanMar 27, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.