submodule-config: remove submodule_from_cache
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. Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 28, 2018 at 15:35 UTC
0c89fdd739183234f86fe2be03a0374705ed93ed
4 files changed
+3
-15
repository.c
+1
-1
@@ -176,7 +176,7 @@ int repo_submodule_init(struct repository *submodule,
176
struct strbuf worktree = STRBUF_INIT;
177
int ret = 0;
178
179
- sub = submodule_from_cache(superproject, &null_oid, path);
179
+ sub = submodule_from_path(superproject, &null_oid, path);
180
if (!sub) {
181
ret = -1;
182
goto out;
submodule-config.c
-9
@@ -635,15 +635,6 @@ const struct submodule *submodule_from_path(struct repository *r,
635
return config_from(r->submodule_cache, treeish_name, path, lookup_path);
636
}
637
638
-const struct submodule *submodule_from_cache(struct repository *repo,
639
- const struct object_id *treeish_name,
640
- const char *key)
641
-{
642
- gitmodules_read_check(repo);
643
- return config_from(repo->submodule_cache, treeish_name,
644
- key, lookup_path);
645
-}
646
-
638
void submodule_free(struct repository *r)
639
{
640
if (r->submodule_cache)
submodule-config.h
-3
@@ -45,9 +45,6 @@ const struct submodule *submodule_from_name(struct repository *r,
45
const struct submodule *submodule_from_path(struct repository *r,
46
const struct object_id *commit_or_tree,
47
const char *path);
48
-extern const struct submodule *submodule_from_cache(struct repository *repo,
49
- const struct object_id *treeish_name,
50
- const char *key);
48
void submodule_free(struct repository *r);
49
50
#endif /* SUBMODULE_CONFIG_H */
submodule.c
+2
-2
@@ -231,7 +231,7 @@ int is_submodule_active(struct repository *repo, const char *path)
231
const struct string_list *sl;
232
const struct submodule *module;
233
234
- module = submodule_from_cache(repo, &null_oid, path);
234
+ module = submodule_from_path(repo, &null_oid, path);
235
236
/* early return if there isn't a path->module mapping */
237
if (!module)
@@ -1236,7 +1236,7 @@ static int get_next_submodule(struct child_process *cp,
1236
if (!S_ISGITLINK(ce->ce_mode))
1237
continue;
1238
1239
- submodule = submodule_from_cache(spf->r, &null_oid, ce->name);
1239
+ submodule = submodule_from_path(spf->r, &null_oid, ce->name);
1240
if (!submodule) {
1241
const char *name = default_name_or_path(ce->name);
1242
if (name) {