@@ -14,7 +14,8 @@ static const char *merge_argument(struct commit *commit)
1414 return oid_to_hex (commit ? & commit -> object .oid : the_hash_algo -> empty_tree );
1515}
1616
17- int try_merge_command (const char * strategy , size_t xopts_nr ,
17+ int try_merge_command (struct repository * r ,
18+ const char * strategy , size_t xopts_nr ,
1819 const char * * xopts , struct commit_list * common ,
1920 const char * head_arg , struct commit_list * remotes )
2021{
@@ -35,15 +36,16 @@ int try_merge_command(const char *strategy, size_t xopts_nr,
3536 ret = run_command_v_opt (args .argv , RUN_GIT_CMD );
3637 argv_array_clear (& args );
3738
38- discard_cache ( );
39- if (read_cache ( ) < 0 )
39+ discard_index ( r -> index );
40+ if (read_index ( r -> index ) < 0 )
4041 die (_ ("failed to read the cache" ));
41- resolve_undo_clear ( );
42+ resolve_undo_clear_index ( r -> index );
4243
4344 return ret ;
4445}
4546
46- int checkout_fast_forward (const struct object_id * head ,
47+ int checkout_fast_forward (struct repository * r ,
48+ const struct object_id * head ,
4749 const struct object_id * remote ,
4850 int overwrite_ignore )
4951{
@@ -54,7 +56,7 @@ int checkout_fast_forward(const struct object_id *head,
5456 struct dir_struct dir ;
5557 struct lock_file lock_file = LOCK_INIT ;
5658
57- refresh_cache ( REFRESH_QUIET );
59+ refresh_index ( r -> index , REFRESH_QUIET , NULL , NULL , NULL );
5860
5961 if (hold_locked_index (& lock_file , LOCK_REPORT_ON_ERROR ) < 0 )
6062 return -1 ;
@@ -86,8 +88,8 @@ int checkout_fast_forward(const struct object_id *head,
8688 }
8789
8890 opts .head_idx = 1 ;
89- opts .src_index = & the_index ;
90- opts .dst_index = & the_index ;
91+ opts .src_index = r -> index ;
92+ opts .dst_index = r -> index ;
9193 opts .update = 1 ;
9294 opts .verbose_update = 1 ;
9395 opts .merge = 1 ;
@@ -101,7 +103,7 @@ int checkout_fast_forward(const struct object_id *head,
101103 }
102104 clear_unpack_trees_porcelain (& opts );
103105
104- if (write_locked_index (& the_index , & lock_file , COMMIT_LOCK ))
106+ if (write_locked_index (r -> index , & lock_file , COMMIT_LOCK ))
105107 return error (_ ("unable to write new index file" ));
106108 return 0 ;
107109}
0 commit comments