@@ -242,20 +242,15 @@ struct rename_conflict_info {
242
242
struct rename * ren2 ;
243
243
const char * branch1 ;
244
244
const char * branch2 ;
245
- struct diff_filespec ren1_other ;
246
- struct diff_filespec ren2_other ;
247
245
};
248
246
249
247
static inline void setup_rename_conflict_info (enum rename_type rename_type ,
250
248
struct merge_options * opt ,
251
249
struct rename * ren1 ,
252
250
struct rename * ren2 ,
253
251
const char * branch1 ,
254
- const char * branch2 ,
255
- struct stage_data * src_entry1 ,
256
- struct stage_data * src_entry2 )
252
+ const char * branch2 )
257
253
{
258
- int ostage1 = 0 , ostage2 ;
259
254
struct rename_conflict_info * ci ;
260
255
261
256
/*
@@ -269,8 +264,7 @@ static inline void setup_rename_conflict_info(enum rename_type rename_type,
269
264
setup_rename_conflict_info (rename_type ,
270
265
opt ,
271
266
ren2 , ren1 ,
272
- branch2 , branch1 ,
273
- src_entry2 , src_entry1 );
267
+ branch2 , branch1 );
274
268
return ;
275
269
}
276
270
@@ -287,28 +281,6 @@ static inline void setup_rename_conflict_info(enum rename_type rename_type,
287
281
if (ren2 ) {
288
282
ci -> ren2 -> dst_entry -> rename_conflict_info = ci ;
289
283
}
290
-
291
- /*
292
- * For each rename, there could have been
293
- * modifications on the side of history where that
294
- * file was not renamed.
295
- */
296
- if (rename_type == RENAME_ADD ||
297
- rename_type == RENAME_TWO_FILES_TO_ONE ) {
298
- ostage1 = opt -> branch1 == branch1 ? 3 : 2 ;
299
-
300
- ci -> ren1_other .path = ren1 -> pair -> one -> path ;
301
- oidcpy (& ci -> ren1_other .oid , & src_entry1 -> stages [ostage1 ].oid );
302
- ci -> ren1_other .mode = src_entry1 -> stages [ostage1 ].mode ;
303
- }
304
-
305
- if (rename_type == RENAME_TWO_FILES_TO_ONE ) {
306
- ostage2 = ostage1 ^ 1 ;
307
-
308
- ci -> ren2_other .path = ren2 -> pair -> one -> path ;
309
- oidcpy (& ci -> ren2_other .oid , & src_entry2 -> stages [ostage2 ].oid );
310
- ci -> ren2_other .mode = src_entry2 -> stages [ostage2 ].mode ;
311
- }
312
284
}
313
285
314
286
static int show (struct merge_options * opt , int v )
@@ -1688,6 +1660,7 @@ static int handle_rename_add(struct merge_options *opt,
1688
1660
/* a was renamed to c, and a separate c was added. */
1689
1661
struct diff_filespec * a = ci -> ren1 -> pair -> one ;
1690
1662
struct diff_filespec * c = ci -> ren1 -> pair -> two ;
1663
+ struct diff_filespec tmp ;
1691
1664
char * path = c -> path ;
1692
1665
char * prev_path_desc ;
1693
1666
struct merge_file_info mfi ;
@@ -1699,8 +1672,12 @@ static int handle_rename_add(struct merge_options *opt,
1699
1672
a -> path , c -> path , ci -> branch1 ,
1700
1673
c -> path , ci -> branch2 );
1701
1674
1675
+ filespec_from_entry (& tmp , ci -> ren1 -> src_entry , other_stage );
1676
+ tmp .path = a -> path ;
1677
+
1702
1678
prev_path_desc = xstrfmt ("version of %s from %s" , path , a -> path );
1703
- if (merge_mode_and_contents (opt , a , c , & ci -> ren1_other , prev_path_desc ,
1679
+ if (merge_mode_and_contents (opt , a , c , & tmp ,
1680
+ prev_path_desc ,
1704
1681
opt -> branch1 , opt -> branch2 ,
1705
1682
1 + opt -> call_depth * 2 , & mfi ))
1706
1683
return -1 ;
@@ -1850,6 +1827,7 @@ static int handle_rename_rename_2to1(struct merge_options *opt,
1850
1827
struct diff_filespec * b = ci -> ren2 -> pair -> one ;
1851
1828
struct diff_filespec * c1 = ci -> ren1 -> pair -> two ;
1852
1829
struct diff_filespec * c2 = ci -> ren2 -> pair -> two ;
1830
+ struct diff_filespec tmp1 , tmp2 ;
1853
1831
char * path = c1 -> path ; /* == c2->path */
1854
1832
char * path_side_1_desc ;
1855
1833
char * path_side_2_desc ;
@@ -1862,12 +1840,17 @@ static int handle_rename_rename_2to1(struct merge_options *opt,
1862
1840
a -> path , c1 -> path , ci -> branch1 ,
1863
1841
b -> path , c2 -> path , ci -> branch2 );
1864
1842
1843
+ filespec_from_entry (& tmp1 , ci -> ren1 -> src_entry , 3 );
1844
+ tmp1 .path = a -> path ;
1845
+ filespec_from_entry (& tmp2 , ci -> ren2 -> src_entry , 2 );
1846
+ tmp2 .path = b -> path ;
1847
+
1865
1848
path_side_1_desc = xstrfmt ("version of %s from %s" , path , a -> path );
1866
1849
path_side_2_desc = xstrfmt ("version of %s from %s" , path , b -> path );
1867
- if (merge_mode_and_contents (opt , a , c1 , & ci -> ren1_other , path_side_1_desc ,
1850
+ if (merge_mode_and_contents (opt , a , c1 , & tmp1 , path_side_1_desc ,
1868
1851
opt -> branch1 , opt -> branch2 ,
1869
1852
1 + opt -> call_depth * 2 , & mfi_c1 ) ||
1870
- merge_mode_and_contents (opt , b , & ci -> ren2_other , c2 , path_side_2_desc ,
1853
+ merge_mode_and_contents (opt , b , & tmp2 , c2 , path_side_2_desc ,
1871
1854
opt -> branch1 , opt -> branch2 ,
1872
1855
1 + opt -> call_depth * 2 , & mfi_c2 ))
1873
1856
return -1 ;
@@ -2728,9 +2711,7 @@ static int process_renames(struct merge_options *opt,
2728
2711
ren1 ,
2729
2712
ren2 ,
2730
2713
branch1 ,
2731
- branch2 ,
2732
- NULL ,
2733
- NULL );
2714
+ branch2 );
2734
2715
} else if ((lookup = string_list_lookup (renames2Dst , ren1_dst ))) {
2735
2716
/* Two different files renamed to the same thing */
2736
2717
char * ren2_dst ;
@@ -2753,9 +2734,7 @@ static int process_renames(struct merge_options *opt,
2753
2734
ren1 ,
2754
2735
ren2 ,
2755
2736
branch1 ,
2756
- branch2 ,
2757
- ren1 -> src_entry ,
2758
- ren2 -> src_entry );
2737
+ branch2 );
2759
2738
2760
2739
} else {
2761
2740
/* Renamed in 1, maybe changed in 2 */
@@ -2794,18 +2773,14 @@ static int process_renames(struct merge_options *opt,
2794
2773
ren1 ,
2795
2774
NULL ,
2796
2775
branch1 ,
2797
- branch2 ,
2798
- NULL ,
2799
- NULL );
2776
+ branch2 );
2800
2777
} else if (oid_eq (& src_other .oid , & null_oid )) {
2801
2778
setup_rename_conflict_info (RENAME_DELETE ,
2802
2779
opt ,
2803
2780
ren1 ,
2804
2781
NULL ,
2805
2782
branch1 ,
2806
- branch2 ,
2807
- NULL ,
2808
- NULL );
2783
+ branch2 );
2809
2784
} else if ((dst_other .mode == ren1 -> pair -> two -> mode ) &&
2810
2785
oid_eq (& dst_other .oid , & ren1 -> pair -> two -> oid )) {
2811
2786
/*
@@ -2836,9 +2811,7 @@ static int process_renames(struct merge_options *opt,
2836
2811
ren1 ,
2837
2812
NULL ,
2838
2813
branch1 ,
2839
- branch2 ,
2840
- ren1 -> src_entry ,
2841
- NULL );
2814
+ branch2 );
2842
2815
} else
2843
2816
try_merge = 1 ;
2844
2817
@@ -2862,8 +2835,6 @@ static int process_renames(struct merge_options *opt,
2862
2835
ren1 ,
2863
2836
NULL ,
2864
2837
branch1 ,
2865
- NULL ,
2866
- NULL ,
2867
2838
NULL );
2868
2839
}
2869
2840
}
0 commit comments