submodule-config: remove submodule_from_cache
authorStefan Beller <sbeller@google.com>
Wed, 28 Mar 2018 22:35:30 +0000 (15:35 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Mar 2018 16:44:51 +0000 (09:44 -0700)
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>
repository.c
submodule-config.c
submodule-config.h
submodule.c
index a4848c1bd05e94efbf7aadf155c2cce504523c83..eb5b8e9f5a9183d981816b75859a2b9aa223d2dc 100644 (file)
@@ -176,7 +176,7 @@ int repo_submodule_init(struct repository *submodule,
        struct strbuf worktree = STRBUF_INIT;
        int ret = 0;
 
        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;
        if (!sub) {
                ret = -1;
                goto out;
index 0ea1e927d23584a147dc18b1cb8c036274edf3df..9abe9166d52796add52928c88f88a11141d21482 100644 (file)
@@ -635,15 +635,6 @@ const struct submodule *submodule_from_path(struct repository *r,
        return config_from(r->submodule_cache, treeish_name, path, lookup_path);
 }
 
        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)
 void submodule_free(struct repository *r)
 {
        if (r->submodule_cache)
index 43dfe7dec0b6582705b525b0628344e89b76e945..6f686184e86cc0004410aae3b771de4d3b488a13 100644 (file)
@@ -45,9 +45,6 @@ const struct submodule *submodule_from_name(struct repository *r,
 const struct submodule *submodule_from_path(struct repository *r,
                                            const struct object_id *commit_or_tree,
                                            const char *path);
 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);
 void submodule_free(struct repository *r);
 
 #endif /* SUBMODULE_CONFIG_H */
 void submodule_free(struct repository *r);
 
 #endif /* SUBMODULE_CONFIG_H */
index 9279cff2d755f959f650d8c64ffb2cb63da066c4..dac73d10a70df2872ed0458d377f2e40ac6c8b86 100644 (file)
@@ -231,7 +231,7 @@ int is_submodule_active(struct repository *repo, const char *path)
        const struct string_list *sl;
        const struct submodule *module;
 
        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)
 
        /* early return if there isn't a path->module mapping */
        if (!module)
@@ -1236,7 +1236,7 @@ static int get_next_submodule(struct child_process *cp,
                if (!S_ISGITLINK(ce->ce_mode))
                        continue;
 
                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) {
                if (!submodule) {
                        const char *name = default_name_or_path(ce->name);
                        if (name) {