diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-01-12 03:13:26 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-14 21:13:04 +0100 |
commit | e1ff0a32e48eb0f3e53970df3f941d183093ff5a (patch) | |
tree | b9d9a617170b562f93a9d262443a8bc45834ed74 /read-cache.c | |
parent | checkout: avoid the_index when possible (diff) | |
download | git-e1ff0a32e48eb0f3e53970df3f941d183093ff5a.tar.xz git-e1ff0a32e48eb0f3e53970df3f941d183093ff5a.zip |
read-cache.c: kill read_index()
read_index() shares the same problem as hold_locked_index(): it
assumes $GIT_DIR/index. Move all call sites to repo_read_index()
instead. read_index_preload() and read_index_unmerged() are also
killed as a consequence.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/read-cache.c b/read-cache.c index 1030e11051..afbf976107 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1733,11 +1733,6 @@ static int read_index_extension(struct index_state *istate, return 0; } -int read_index(struct index_state *istate) -{ - return read_index_from(istate, get_index_file(), get_git_dir()); -} - static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool, unsigned int version, struct ondisk_cache_entry *ondisk, @@ -3218,12 +3213,14 @@ out: * state can call this and check its return value, instead of calling * read_cache(). */ -int read_index_unmerged(struct index_state *istate) +int repo_read_index_unmerged(struct repository *repo) { + struct index_state *istate; int i; int unmerged = 0; - read_index(istate); + repo_read_index(repo); + istate = repo->index; for (i = 0; i < istate->cache_nr; i++) { struct cache_entry *ce = istate->cache[i]; struct cache_entry *new_ce; |