@@ -465,17 +465,18 @@ static void get_files_dirs(struct merge_options *opt, struct tree *tree)
465
465
{
466
466
struct pathspec match_all ;
467
467
memset (& match_all , 0 , sizeof (match_all ));
468
- read_tree_recursive (the_repository , tree , "" , 0 , 0 ,
468
+ read_tree_recursive (opt -> repo , tree , "" , 0 , 0 ,
469
469
& match_all , save_files_dirs , opt );
470
470
}
471
471
472
- static int get_tree_entry_if_blob (const struct object_id * tree ,
472
+ static int get_tree_entry_if_blob (struct repository * r ,
473
+ const struct object_id * tree ,
473
474
const char * path ,
474
475
struct diff_filespec * dfs )
475
476
{
476
477
int ret ;
477
478
478
- ret = get_tree_entry (the_repository , tree , path , & dfs -> oid , & dfs -> mode );
479
+ ret = get_tree_entry (r , tree , path , & dfs -> oid , & dfs -> mode );
479
480
if (S_ISDIR (dfs -> mode )) {
480
481
oidcpy (& dfs -> oid , & null_oid );
481
482
dfs -> mode = 0 ;
@@ -487,15 +488,16 @@ static int get_tree_entry_if_blob(const struct object_id *tree,
487
488
* Returns an index_entry instance which doesn't have to correspond to
488
489
* a real cache entry in Git's index.
489
490
*/
490
- static struct stage_data * insert_stage_data (const char * path ,
491
+ static struct stage_data * insert_stage_data (struct repository * r ,
492
+ const char * path ,
491
493
struct tree * o , struct tree * a , struct tree * b ,
492
494
struct string_list * entries )
493
495
{
494
496
struct string_list_item * item ;
495
497
struct stage_data * e = xcalloc (1 , sizeof (struct stage_data ));
496
- get_tree_entry_if_blob (& o -> object .oid , path , & e -> stages [1 ]);
497
- get_tree_entry_if_blob (& a -> object .oid , path , & e -> stages [2 ]);
498
- get_tree_entry_if_blob (& b -> object .oid , path , & e -> stages [3 ]);
498
+ get_tree_entry_if_blob (r , & o -> object .oid , path , & e -> stages [1 ]);
499
+ get_tree_entry_if_blob (r , & a -> object .oid , path , & e -> stages [2 ]);
500
+ get_tree_entry_if_blob (r , & b -> object .oid , path , & e -> stages [3 ]);
499
501
item = string_list_insert (entries , path );
500
502
item -> util = e ;
501
503
return e ;
@@ -1900,12 +1902,13 @@ static struct diff_queue_struct *get_diffpairs(struct merge_options *opt,
1900
1902
return ret ;
1901
1903
}
1902
1904
1903
- static int tree_has_path (struct tree * tree , const char * path )
1905
+ static int tree_has_path (struct repository * r , struct tree * tree ,
1906
+ const char * path )
1904
1907
{
1905
1908
struct object_id hashy ;
1906
1909
unsigned short mode_o ;
1907
1910
1908
- return !get_tree_entry (the_repository ,
1911
+ return !get_tree_entry (r ,
1909
1912
& tree -> object .oid , path ,
1910
1913
& hashy , & mode_o );
1911
1914
}
@@ -2057,7 +2060,7 @@ static char *handle_path_level_conflicts(struct merge_options *opt,
2057
2060
*/
2058
2061
if (collision_ent -> reported_already ) {
2059
2062
clean = 0 ;
2060
- } else if (tree_has_path (tree , new_path )) {
2063
+ } else if (tree_has_path (opt -> repo , tree , new_path )) {
2061
2064
collision_ent -> reported_already = 1 ;
2062
2065
strbuf_add_separated_string_list (& collision_paths , ", " ,
2063
2066
& collision_ent -> source_files );
@@ -2135,7 +2138,7 @@ static void handle_directory_level_conflicts(struct merge_options *opt,
2135
2138
string_list_append (& remove_from_merge ,
2136
2139
merge_ent -> dir )-> util = merge_ent ;
2137
2140
strbuf_release (& merge_ent -> new_dir );
2138
- } else if (tree_has_path (head , head_ent -> dir )) {
2141
+ } else if (tree_has_path (opt -> repo , head , head_ent -> dir )) {
2139
2142
/* 2. This wasn't a directory rename after all */
2140
2143
string_list_append (& remove_from_head ,
2141
2144
head_ent -> dir )-> util = head_ent ;
@@ -2149,7 +2152,7 @@ static void handle_directory_level_conflicts(struct merge_options *opt,
2149
2152
hashmap_iter_init (dir_re_merge , & iter );
2150
2153
while ((merge_ent = hashmap_iter_next (& iter ))) {
2151
2154
head_ent = dir_rename_find_entry (dir_re_head , merge_ent -> dir );
2152
- if (tree_has_path (merge , merge_ent -> dir )) {
2155
+ if (tree_has_path (opt -> repo , merge , merge_ent -> dir )) {
2153
2156
/* 2. This wasn't a directory rename after all */
2154
2157
string_list_append (& remove_from_merge ,
2155
2158
merge_ent -> dir )-> util = merge_ent ;
@@ -2478,7 +2481,7 @@ static void apply_directory_rename_modifications(struct merge_options *opt,
2478
2481
if (pair -> status == 'R' )
2479
2482
re -> dst_entry -> processed = 1 ;
2480
2483
2481
- re -> dst_entry = insert_stage_data (new_path ,
2484
+ re -> dst_entry = insert_stage_data (opt -> repo , new_path ,
2482
2485
o_tree , a_tree , b_tree ,
2483
2486
entries );
2484
2487
item = string_list_insert (entries , new_path );
@@ -2587,14 +2590,16 @@ static struct string_list *get_renames(struct merge_options *opt,
2587
2590
re -> dir_rename_original_dest = NULL ;
2588
2591
item = string_list_lookup (entries , re -> pair -> one -> path );
2589
2592
if (!item )
2590
- re -> src_entry = insert_stage_data (re -> pair -> one -> path ,
2593
+ re -> src_entry = insert_stage_data (opt -> repo ,
2594
+ re -> pair -> one -> path ,
2591
2595
o_tree , a_tree , b_tree , entries );
2592
2596
else
2593
2597
re -> src_entry = item -> util ;
2594
2598
2595
2599
item = string_list_lookup (entries , re -> pair -> two -> path );
2596
2600
if (!item )
2597
- re -> dst_entry = insert_stage_data (re -> pair -> two -> path ,
2601
+ re -> dst_entry = insert_stage_data (opt -> repo ,
2602
+ re -> pair -> two -> path ,
2598
2603
o_tree , a_tree , b_tree , entries );
2599
2604
else
2600
2605
re -> dst_entry = item -> util ;
0 commit comments