@@ -18,11 +18,13 @@ struct notes_merge_pair {
1818 struct object_id obj , base , local , remote ;
1919};
2020
21- void init_notes_merge_options (struct notes_merge_options * o )
21+ void init_notes_merge_options (struct repository * r ,
22+ struct notes_merge_options * o )
2223{
2324 memset (o , 0 , sizeof (struct notes_merge_options ));
2425 strbuf_init (& (o -> commit_msg ), 0 );
2526 o -> verbosity = NOTES_MERGE_VERBOSITY_DEFAULT ;
27+ o -> repo = r ;
2628}
2729
2830static int path_to_oid (const char * path , struct object_id * oid )
@@ -127,7 +129,7 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
127129 trace_printf ("\tdiff_tree_remote(base = %.7s, remote = %.7s)\n" ,
128130 oid_to_hex (base ), oid_to_hex (remote ));
129131
130- repo_diff_setup (the_repository , & opt );
132+ repo_diff_setup (o -> repo , & opt );
131133 opt .flags .recursive = 1 ;
132134 opt .output_format = DIFF_FORMAT_NO_OUTPUT ;
133135 diff_setup_done (& opt );
@@ -190,7 +192,7 @@ static void diff_tree_local(struct notes_merge_options *o,
190192 trace_printf ("\tdiff_tree_local(len = %i, base = %.7s, local = %.7s)\n" ,
191193 len , oid_to_hex (base ), oid_to_hex (local ));
192194
193- repo_diff_setup (the_repository , & opt );
195+ repo_diff_setup (o -> repo , & opt );
194196 opt .flags .recursive = 1 ;
195197 opt .output_format = DIFF_FORMAT_NO_OUTPUT ;
196198 diff_setup_done (& opt );
@@ -350,7 +352,7 @@ static int ll_merge_in_worktree(struct notes_merge_options *o,
350352
351353 status = ll_merge (& result_buf , oid_to_hex (& p -> obj ), & base , NULL ,
352354 & local , o -> local_ref , & remote , o -> remote_ref ,
353- & the_index , NULL );
355+ o -> repo -> index , NULL );
354356
355357 free (base .ptr );
356358 free (local .ptr );
@@ -711,7 +713,7 @@ int notes_merge_commit(struct notes_merge_options *o,
711713 /* write file as blob, and add to partial_tree */
712714 if (stat (path .buf , & st ))
713715 die_errno ("Failed to stat '%s'" , path .buf );
714- if (index_path (& the_index , & blob_oid , path .buf , & st , HASH_WRITE_OBJECT ))
716+ if (index_path (o -> repo -> index , & blob_oid , path .buf , & st , HASH_WRITE_OBJECT ))
715717 die ("Failed to write blob object from '%s'" , path .buf );
716718 if (add_note (partial_tree , & obj_oid , & blob_oid , NULL ))
717719 die ("Failed to add resolved note '%s' to notes tree" ,
0 commit comments