Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- revision.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/revision.c b/revision.c index 40fd91ff2b..d56ca57717 100644 --- a/revision.c +++ b/revision.c @@ -1354,7 +1354,7 @@ void add_index_objects_to_pending(struct rev_info *revs, unsigned int flags) { struct worktree **worktrees, **p; - read_cache(); + read_index(&the_index); do_add_index_objects_to_pending(revs, &the_index); if (revs->single_worktree) @@ -1495,10 +1495,10 @@ static void prepare_show_merge(struct rev_info *revs) free_commit_list(bases); head->object.flags |= SYMMETRIC_LEFT; - if (!active_nr) - read_cache(); - for (i = 0; i < active_nr; i++) { - const struct cache_entry *ce = active_cache[i]; + if (!the_index.cache_nr) + read_index(&the_index); + for (i = 0; i < the_index.cache_nr; i++) { + const struct cache_entry *ce = the_index.cache[i]; if (!ce_stage(ce)) continue; if (ce_path_match(ce, &revs->prune_data, NULL)) { @@ -1507,8 +1507,8 @@ static void prepare_show_merge(struct rev_info *revs) prune[prune_num-2] = ce->name; prune[prune_num-1] = NULL; } - while ((i+1 < active_nr) && - ce_same_name(ce, active_cache[i+1])) + while ((i+1 < the_index.cache_nr) && + ce_same_name(ce, the_index.cache[i+1])) i++; } clear_pathspec(&revs->prune_data); -- 2.18.0.rc0.333.g22e6ee6cdf