@@ -952,9 +952,31 @@ static int process_renames(struct merge_options *o,
952952 "%s added in %s" ,
953953 ren1_src , ren1_dst , branch1 ,
954954 ren1_dst , branch2 );
955- new_path = unique_path (o , ren1_dst , branch2 );
956- output (o , 1 , "Adding as %s instead" , new_path );
957- update_file (o , 0 , dst_other .sha1 , dst_other .mode , new_path );
955+ if (o -> call_depth ) {
956+ struct merge_file_info mfi ;
957+ struct diff_filespec one , a , b ;
958+
959+ one .path = a .path = b .path =
960+ (char * )ren1_dst ;
961+ hashcpy (one .sha1 , null_sha1 );
962+ one .mode = 0 ;
963+ hashcpy (a .sha1 , ren1 -> pair -> two -> sha1 );
964+ a .mode = ren1 -> pair -> two -> mode ;
965+ hashcpy (b .sha1 , dst_other .sha1 );
966+ b .mode = dst_other .mode ;
967+ mfi = merge_file (o , & one , & a , & b ,
968+ branch1 ,
969+ branch2 );
970+ output (o , 1 , "Adding merged %s" , ren1_dst );
971+ update_file (o , 0 ,
972+ mfi .sha ,
973+ mfi .mode ,
974+ ren1_dst );
975+ } else {
976+ new_path = unique_path (o , ren1_dst , branch2 );
977+ output (o , 1 , "Adding as %s instead" , new_path );
978+ update_file (o , 0 , dst_other .sha1 , dst_other .mode , new_path );
979+ }
958980 } else if ((item = string_list_lookup (ren1_dst , renames2Dst ))) {
959981 ren2 = item -> util ;
960982 clean_merge = 0 ;
0 commit comments