]> git.ipfire.org Git - thirdparty/git.git/blobdiff - repository.c
cache API: add a "INDEX_STATE_INIT" macro/function, add release_index()
[thirdparty/git.git] / repository.c
index 3427085fd6d2e44fa32c3e0ebc4ffba7a4c8286f..a5805fa33b1cb1f2cf7d1a1bd4a5ad00aa96ddc7 100644 (file)
@@ -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)