X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=submodule-config.c;h=4264ee216f49773c86e2e161d28ceec656a1273c;hb=1d9f0b79a0f568c4d40703ff223b8ea80abcb086;hp=66653e86b9f87de01332e3d1405edd218cbf1581;hpb=af1ec93755ac0b2bd71d6cf48096164b683bc881;p=thirdparty%2Fgit.git diff --git a/submodule-config.c b/submodule-config.c index 66653e86b9..4264ee216f 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -625,23 +625,16 @@ static void config_from_gitmodules(config_fn_t fn, struct repository *repo, void const struct config_options opts = { 0 }; struct object_id oid; char *file; + char *oidstr = NULL; file = repo_worktree_path(repo, GITMODULES_FILE); if (file_exists(file)) { config_source.file = file; - } else if (repo->submodule_prefix) { - /* - * When get_oid and config_with_options, used below, - * become able to work on a specific repository, this - * warning branch can be removed. - */ - warning("nested submodules without %s in the working tree are not supported yet", - GITMODULES_FILE); - goto out; - } else if (get_oid(GITMODULES_INDEX, &oid) >= 0) { - config_source.blob = GITMODULES_INDEX; - } else if (get_oid(GITMODULES_HEAD, &oid) >= 0) { - config_source.blob = GITMODULES_HEAD; + } else if (repo_get_oid(repo, GITMODULES_INDEX, &oid) >= 0 || + repo_get_oid(repo, GITMODULES_HEAD, &oid) >= 0) { + config_source.blob = oidstr = xstrdup(oid_to_hex(&oid)); + if (repo != the_repository) + add_to_alternates_memory(repo->objects->odb->path); } else { goto out; } @@ -649,6 +642,7 @@ static void config_from_gitmodules(config_fn_t fn, struct repository *repo, void config_with_options(fn, data, &config_source, &opts); out: + free(oidstr); free(file); } }