repository: add index_state to struct repo
Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
3b256228a6
commit
639e30b5b2
16
repository.c
16
repository.c
@ -163,4 +163,20 @@ void repo_clear(struct repository *repo)
|
||||
free(repo->config);
|
||||
repo->config = NULL;
|
||||
}
|
||||
|
||||
if (repo->index) {
|
||||
discard_index(repo->index);
|
||||
free(repo->index);
|
||||
repo->index = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int repo_read_index(struct repository *repo)
|
||||
{
|
||||
if (!repo->index)
|
||||
repo->index = xcalloc(1, sizeof(*repo->index));
|
||||
else
|
||||
discard_index(repo->index);
|
||||
|
||||
return read_index_from(repo->index, repo->index_file);
|
||||
}
|
||||
|
Reference in New Issue
Block a user