@@ -1063,12 +1063,13 @@ static int merge_3way(struct merge_options *o,
10631063}
10641064
10651065static 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 )
10721073{
10731074 result -> merge = 0 ;
10741075 result -> clean = 1 ;
@@ -1148,18 +1149,22 @@ static int merge_file_1(struct merge_options *o,
11481149 die ("BUG: unsupported object type in the tree" );
11491150 }
11501151
1152+ if (result -> merge )
1153+ output (o , 2 , _ ("Auto-merging %s" ), filename );
1154+
11511155 return 0 ;
11521156}
11531157
11541158static 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 )
11631168{
11641169 char * side1 = NULL ;
11651170 char * side2 = NULL ;
@@ -1170,22 +1175,23 @@ static int merge_file_special_markers(struct merge_options *o,
11701175 if (filename2 )
11711176 side2 = xstrfmt ("%s:%s" , branch2 , filename2 );
11721177
1173- ret = merge_file_1 (o , one , a , b ,
1178+ ret = merge_file_1 (o , one , a , b , target_filename ,
11741179 side1 ? side1 : branch1 ,
11751180 side2 ? side2 : branch2 , mfi );
1181+
11761182 free (side1 );
11771183 free (side2 );
11781184 return ret ;
11791185}
11801186
11811187static 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 )
11891195{
11901196 struct diff_filespec one , a , b ;
11911197
@@ -1196,7 +1202,7 @@ static int merge_file_one(struct merge_options *o,
11961202 a .mode = a_mode ;
11971203 oidcpy (& b .oid , b_oid );
11981204 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 );
12001206}
12011207
12021208static int conflict_rename_dir (struct merge_options * o ,
@@ -1474,6 +1480,8 @@ static int conflict_rename_rename_2to1(struct merge_options *o,
14741480 struct diff_filespec * c1 = ci -> pair1 -> two ;
14751481 struct diff_filespec * c2 = ci -> pair2 -> two ;
14761482 char * path = c1 -> path ; /* == c2->path */
1483+ char * path_side_1_desc ;
1484+ char * path_side_2_desc ;
14771485 struct merge_file_info mfi_c1 ;
14781486 struct merge_file_info mfi_c2 ;
14791487 int ret ;
@@ -1487,13 +1495,19 @@ static int conflict_rename_rename_2to1(struct merge_options *o,
14871495 remove_file (o , 1 , a -> path , o -> call_depth || would_lose_untracked (a -> path ));
14881496 remove_file (o , 1 , b -> path , o -> call_depth || would_lose_untracked (b -> path ));
14891497
1498+ path_side_1_desc = xstrfmt ("%s (was %s)" , path , a -> path );
1499+ path_side_2_desc = xstrfmt ("%s (was %s)" , path , b -> path );
14901500 if (merge_file_special_markers (o , a , c1 , & ci -> ren1_other ,
1501+ path_side_1_desc ,
14911502 o -> branch1 , c1 -> path ,
14921503 o -> branch2 , ci -> ren1_other .path , & mfi_c1 ) ||
14931504 merge_file_special_markers (o , b , & ci -> ren2_other , c2 ,
1505+ path_side_2_desc ,
14941506 o -> branch1 , ci -> ren2_other .path ,
14951507 o -> branch2 , c2 -> path , & mfi_c2 ))
14961508 return -1 ;
1509+ free (path_side_1_desc );
1510+ free (path_side_2_desc );
14971511
14981512 if (o -> call_depth ) {
14991513 /*
@@ -2802,7 +2816,7 @@ static int merge_content(struct merge_options *o,
28022816 S_ISGITLINK (pair1 -> two -> mode )))
28032817 df_conflict_remains = 1 ;
28042818 }
2805- if (merge_file_special_markers (o , & one , & a , & b ,
2819+ if (merge_file_special_markers (o , & one , & a , & b , path ,
28062820 o -> branch1 , path1 ,
28072821 o -> branch2 , path2 , & mfi ))
28082822 return -1 ;
@@ -2824,8 +2838,7 @@ static int merge_content(struct merge_options *o,
28242838 return -1 ;
28252839 return mfi .clean ;
28262840 }
2827- } else
2828- output (o , 2 , _ ("Auto-merging %s" ), path );
2841+ }
28292842
28302843 if (!mfi .clean ) {
28312844 if (S_ISGITLINK (mfi .mode ))
0 commit comments