Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 blame.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/blame.c b/blame.c
index 14d0e0b575..c357cf2f49 100644
--- a/blame.c
+++ b/blame.c
@@ -85,11 +85,11 @@ static void verify_working_tree_path(struct commit 
*work_tree, const char *path)
                        return;
        }
 
-       pos = cache_name_pos(path, strlen(path));
+       pos = index_name_pos(&the_index, path, strlen(path));
        if (pos >= 0)
                ; /* path is in the index */
-       else if (-1 - pos < active_nr &&
-                !strcmp(active_cache[-1 - pos]->name, path))
+       else if (-1 - pos < the_index.cache_nr &&
+                !strcmp(the_index.cache[-1 - pos]->name, path))
                ; /* path is in the index, unmerged */
        else
                die("no such path '%s' in HEAD", path);
@@ -159,7 +159,7 @@ static struct commit *fake_working_tree_commit(struct 
diff_options *opt,
        unsigned mode;
        struct strbuf msg = STRBUF_INIT;
 
-       read_cache();
+       read_index(&the_index);
        time(&now);
        commit = alloc_commit_node();
        commit->object.parsed = 1;
@@ -240,14 +240,14 @@ static struct commit *fake_working_tree_commit(struct 
diff_options *opt,
         * bits; we are not going to write this index out -- we just
         * want to run "diff-index --cached".
         */
-       discard_cache();
-       read_cache();
+       discard_index(&the_index);
+       read_index(&the_index);
 
        len = strlen(path);
        if (!mode) {
-               int pos = cache_name_pos(path, len);
+               int pos = index_name_pos(&the_index, path, len);
                if (0 <= pos)
-                       mode = active_cache[pos]->ce_mode;
+                       mode = the_index.cache[pos]->ce_mode;
                else
                        /* Let's not bother reading from HEAD tree */
                        mode = S_IFREG | 0644;
@@ -259,7 +259,8 @@ static struct commit *fake_working_tree_commit(struct 
diff_options *opt,
        ce->ce_flags = create_ce_flags(0);
        ce->ce_namelen = len;
        ce->ce_mode = create_ce_mode(mode);
-       add_cache_entry(ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
+       add_index_entry(&the_index, ce,
+                       ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);
 
        cache_tree_invalidate_path(&the_index, path);
 
-- 
2.18.0.rc0.333.g22e6ee6cdf

Reply via email to