@@ -1063,12 +1063,13 @@ static int merge_3way(struct merge_options *o,
1063
1063
}
1064
1064
1065
1065
static int merge_file_1 (struct merge_options * o ,
1066
- const struct diff_filespec * one ,
1067
- const struct diff_filespec * a ,
1068
- const struct diff_filespec * b ,
1069
- const char * branch1 ,
1070
- const char * branch2 ,
1071
- struct merge_file_info * result )
1066
+ const struct diff_filespec * one ,
1067
+ const struct diff_filespec * a ,
1068
+ const struct diff_filespec * b ,
1069
+ const char * filename ,
1070
+ const char * branch1 ,
1071
+ const char * branch2 ,
1072
+ struct merge_file_info * result )
1072
1073
{
1073
1074
result -> merge = 0 ;
1074
1075
result -> clean = 1 ;
@@ -1148,18 +1149,22 @@ static int merge_file_1(struct merge_options *o,
1148
1149
die ("BUG: unsupported object type in the tree" );
1149
1150
}
1150
1151
1152
+ if (result -> merge )
1153
+ output (o , 2 , _ ("Auto-merging %s" ), filename );
1154
+
1151
1155
return 0 ;
1152
1156
}
1153
1157
1154
1158
static int merge_file_special_markers (struct merge_options * o ,
1155
- const struct diff_filespec * one ,
1156
- const struct diff_filespec * a ,
1157
- const struct diff_filespec * b ,
1158
- const char * branch1 ,
1159
- const char * filename1 ,
1160
- const char * branch2 ,
1161
- const char * filename2 ,
1162
- struct merge_file_info * mfi )
1159
+ const struct diff_filespec * one ,
1160
+ const struct diff_filespec * a ,
1161
+ const struct diff_filespec * b ,
1162
+ const char * target_filename ,
1163
+ const char * branch1 ,
1164
+ const char * filename1 ,
1165
+ const char * branch2 ,
1166
+ const char * filename2 ,
1167
+ struct merge_file_info * mfi )
1163
1168
{
1164
1169
char * side1 = NULL ;
1165
1170
char * side2 = NULL ;
@@ -1170,22 +1175,23 @@ static int merge_file_special_markers(struct merge_options *o,
1170
1175
if (filename2 )
1171
1176
side2 = xstrfmt ("%s:%s" , branch2 , filename2 );
1172
1177
1173
- ret = merge_file_1 (o , one , a , b ,
1178
+ ret = merge_file_1 (o , one , a , b , target_filename ,
1174
1179
side1 ? side1 : branch1 ,
1175
1180
side2 ? side2 : branch2 , mfi );
1181
+
1176
1182
free (side1 );
1177
1183
free (side2 );
1178
1184
return ret ;
1179
1185
}
1180
1186
1181
1187
static int merge_file_one (struct merge_options * o ,
1182
- const char * path ,
1183
- const struct object_id * o_oid , int o_mode ,
1184
- const struct object_id * a_oid , int a_mode ,
1185
- const struct object_id * b_oid , int b_mode ,
1186
- const char * branch1 ,
1187
- const char * branch2 ,
1188
- struct merge_file_info * mfi )
1188
+ const char * path ,
1189
+ const struct object_id * o_oid , int o_mode ,
1190
+ const struct object_id * a_oid , int a_mode ,
1191
+ const struct object_id * b_oid , int b_mode ,
1192
+ const char * branch1 ,
1193
+ const char * branch2 ,
1194
+ struct merge_file_info * mfi )
1189
1195
{
1190
1196
struct diff_filespec one , a , b ;
1191
1197
@@ -1196,7 +1202,7 @@ static int merge_file_one(struct merge_options *o,
1196
1202
a .mode = a_mode ;
1197
1203
oidcpy (& b .oid , b_oid );
1198
1204
b .mode = b_mode ;
1199
- return merge_file_1 (o , & one , & a , & b , branch1 , branch2 , mfi );
1205
+ return merge_file_1 (o , & one , & a , & b , path , branch1 , branch2 , mfi );
1200
1206
}
1201
1207
1202
1208
static int conflict_rename_dir (struct merge_options * o ,
@@ -1474,6 +1480,8 @@ static int conflict_rename_rename_2to1(struct merge_options *o,
1474
1480
struct diff_filespec * c1 = ci -> pair1 -> two ;
1475
1481
struct diff_filespec * c2 = ci -> pair2 -> two ;
1476
1482
char * path = c1 -> path ; /* == c2->path */
1483
+ char * path_side_1_desc ;
1484
+ char * path_side_2_desc ;
1477
1485
struct merge_file_info mfi_c1 ;
1478
1486
struct merge_file_info mfi_c2 ;
1479
1487
int ret ;
@@ -1487,13 +1495,19 @@ static int conflict_rename_rename_2to1(struct merge_options *o,
1487
1495
remove_file (o , 1 , a -> path , o -> call_depth || would_lose_untracked (a -> path ));
1488
1496
remove_file (o , 1 , b -> path , o -> call_depth || would_lose_untracked (b -> path ));
1489
1497
1498
+ path_side_1_desc = xstrfmt ("%s (was %s)" , path , a -> path );
1499
+ path_side_2_desc = xstrfmt ("%s (was %s)" , path , b -> path );
1490
1500
if (merge_file_special_markers (o , a , c1 , & ci -> ren1_other ,
1501
+ path_side_1_desc ,
1491
1502
o -> branch1 , c1 -> path ,
1492
1503
o -> branch2 , ci -> ren1_other .path , & mfi_c1 ) ||
1493
1504
merge_file_special_markers (o , b , & ci -> ren2_other , c2 ,
1505
+ path_side_2_desc ,
1494
1506
o -> branch1 , ci -> ren2_other .path ,
1495
1507
o -> branch2 , c2 -> path , & mfi_c2 ))
1496
1508
return -1 ;
1509
+ free (path_side_1_desc );
1510
+ free (path_side_2_desc );
1497
1511
1498
1512
if (o -> call_depth ) {
1499
1513
/*
@@ -2802,7 +2816,7 @@ static int merge_content(struct merge_options *o,
2802
2816
S_ISGITLINK (pair1 -> two -> mode )))
2803
2817
df_conflict_remains = 1 ;
2804
2818
}
2805
- if (merge_file_special_markers (o , & one , & a , & b ,
2819
+ if (merge_file_special_markers (o , & one , & a , & b , path ,
2806
2820
o -> branch1 , path1 ,
2807
2821
o -> branch2 , path2 , & mfi ))
2808
2822
return -1 ;
@@ -2824,8 +2838,7 @@ static int merge_content(struct merge_options *o,
2824
2838
return -1 ;
2825
2839
return mfi .clean ;
2826
2840
}
2827
- } else
2828
- output (o , 2 , _ ("Auto-merging %s" ), path );
2841
+ }
2829
2842
2830
2843
if (!mfi .clean ) {
2831
2844
if (S_ISGITLINK (mfi .mode ))
0 commit comments