Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- sha1-name.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 60d9ef3c7e..8344d9a9e0 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1560,11 +1560,11 @@ static void diagnose_invalid_index_path(int stage, prefix = ""; /* Wrong stage number? */ - pos = cache_name_pos(filename, namelen); + pos = index_name_pos(&the_index, filename, namelen); if (pos < 0) pos = -pos - 1; - if (pos < active_nr) { - ce = active_cache[pos]; + if (pos < the_index.cache_nr) { + ce = the_index.cache[pos]; if (ce_namelen(ce) == namelen && !memcmp(ce->name, filename, namelen)) die("Path '%s' is in the index, but not at stage %d.\n" @@ -1576,11 +1576,11 @@ static void diagnose_invalid_index_path(int stage, /* Confusion between relative and absolute filenames? */ strbuf_addstr(&fullname, prefix); strbuf_addstr(&fullname, filename); - pos = cache_name_pos(fullname.buf, fullname.len); + pos = index_name_pos(&the_index, fullname.buf, fullname.len); if (pos < 0) pos = -pos - 1; - if (pos < active_nr) { - ce = active_cache[pos]; + if (pos < the_index.cache_nr) { + ce = the_index.cache[pos]; if (ce_namelen(ce) == fullname.len && !memcmp(ce->name, fullname.buf, fullname.len)) die("Path '%s' is in the index, but not '%s'.\n" @@ -1672,13 +1672,13 @@ static int get_oid_with_context_1(const char *name, if (flags & GET_OID_RECORD_PATH) oc->path = xstrdup(cp); - if (!active_cache) - read_cache(); - pos = cache_name_pos(cp, namelen); + if (!the_index.cache) + read_index(&the_index); + pos = index_name_pos(&the_index, cp, namelen); if (pos < 0) pos = -pos - 1; - while (pos < active_nr) { - ce = active_cache[pos]; + while (pos < the_index.cache_nr) { + ce = the_index.cache[pos]; if (ce_namelen(ce) != namelen || memcmp(ce->name, cp, namelen)) break; -- 2.18.0.rc0.333.g22e6ee6cdf