aboutsummaryrefslogtreecommitdiffstats
path: root/repository.c
diff options
context:
space:
mode:
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/repository.c b/repository.c
index 3427085fd6..a5805fa33b 100644
--- a/repository.c
+++ b/repository.c
@@ -302,8 +302,10 @@ int repo_read_index(struct repository *repo)
{
int res;
- if (!repo->index)
- CALLOC_ARRAY(repo->index, 1);
+ if (!repo->index) {
+ ALLOC_ARRAY(repo->index, 1);
+ index_state_init(repo->index);
+ }
/* Complete the double-reference */
if (!repo->index->repo)