diff options
Diffstat (limited to 'repository.c')
-rw-r--r-- | repository.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/repository.c b/repository.c index 87b355e7a6..710a3b4bf8 100644 --- a/repository.c +++ b/repository.c @@ -10,6 +10,8 @@ #include "object.h" #include "lockfile.h" #include "submodule-config.h" +#include "sparse-index.h" +#include "promisor-remote.h" /* The main repository */ static struct repository the_repo; @@ -171,6 +173,10 @@ int repo_init(struct repository *repo, repo_set_hash_algo(repo, format.hash_algo); + /* take ownership of format.partial_clone */ + repo->repository_format_partial_clone = format.partial_clone; + format.partial_clone = NULL; + if (worktree) repo_set_worktree(repo, worktree); @@ -207,8 +213,7 @@ int repo_submodule_init(struct repository *subrepo, * submodule would not have a worktree. */ strbuf_reset(&gitdir); - strbuf_repo_git_path(&gitdir, superproject, - "modules/%s", sub->name); + submodule_name_to_gitdir(&gitdir, superproject, sub->name); if (repo_init(subrepo, gitdir.buf, NULL)) { ret = -1; @@ -257,10 +262,17 @@ void repo_clear(struct repository *repo) if (repo->index != &the_index) FREE_AND_NULL(repo->index); } + + if (repo->promisor_remote_config) { + promisor_remote_clear(repo->promisor_remote_config); + FREE_AND_NULL(repo->promisor_remote_config); + } } int repo_read_index(struct repository *repo) { + int res; + if (!repo->index) CALLOC_ARRAY(repo->index, 1); @@ -270,7 +282,13 @@ int repo_read_index(struct repository *repo) else if (repo->index->repo != repo) BUG("repo's index should point back at itself"); - return read_index_from(repo->index, repo->index_file, repo->gitdir); + res = read_index_from(repo->index, repo->index_file, repo->gitdir); + + prepare_repo_settings(repo); + if (repo->settings.command_requires_full_index) + ensure_full_index(repo->index); + + return res; } int repo_hold_locked_index(struct repository *repo, |