summaryrefslogtreecommitdiff
path: root/repository.c
diff options
context:
space:
mode:
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/repository.c b/repository.c
index 87b355e7a6..448cd557d4 100644
--- a/repository.c
+++ b/repository.c
@@ -10,6 +10,7 @@
#include "object.h"
#include "lockfile.h"
#include "submodule-config.h"
+#include "sparse-index.h"
/* The main repository */
static struct repository the_repo;
@@ -261,6 +262,8 @@ void repo_clear(struct repository *repo)
int repo_read_index(struct repository *repo)
{
+ int res;
+
if (!repo->index)
CALLOC_ARRAY(repo->index, 1);
@@ -270,7 +273,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,