Skip to content

Commit 96ecac6

Browse files
newrengitster
authored andcommitted
merge-recursive: Avoid excessive output for and reprocessing of renames
In 5a2580d (merge_recursive: Fix renames across paths below D/F conflicts 2010-07-09) and ae74548 (merge-recursive: Fix multiple file rename across D/F conflict 2010-08-17), renames across D/F conflicts were fixed by making process_renames() consider as unprocessed renames whose dst_entry "still" had higher stage entries. The assumption was that those higher stage entries would have been cleared out of dst_entry by that point in cases where the conflict could be resolved (normal renames with no D/F conflicts). That is not the case -- higher stage entries will remain in all cases. Fix this by checking for higher stage entries corresponding to D/F conflicts, namely that stages 2 and 3 have exactly one nonzero mode between them. The nonzero mode stage corresponds to a file at the path, while the stage with a zero mode will correspond to a directory at that path (since rename/delete conflicts will have already been handled before this codepath is reached.) Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ae74548 commit 96ecac6

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

merge-recursive.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,6 @@ static int process_renames(struct merge_options *o,
10201020
if (mfi.clean &&
10211021
sha_eq(mfi.sha, ren1->pair->two->sha1) &&
10221022
mfi.mode == ren1->pair->two->mode) {
1023-
int i;
10241023
/*
10251024
* This message is part of
10261025
* t6022 test. If you change
@@ -1032,12 +1031,9 @@ static int process_renames(struct merge_options *o,
10321031
* in the index (e.g. due to a D/F
10331032
* conflict) that need to be resolved.
10341033
*/
1035-
for (i = 1; i <= 3; i++) {
1036-
if (!ren1->dst_entry->stages[i].mode)
1037-
continue;
1034+
if (!ren1->dst_entry->stages[2].mode !=
1035+
!ren1->dst_entry->stages[3].mode)
10381036
ren1->dst_entry->processed = 0;
1039-
break;
1040-
}
10411037
} else {
10421038
if (mfi.merge || !mfi.clean)
10431039
output(o, 1, "Renaming %s => %s", ren1_src, ren1_dst);

0 commit comments

Comments
 (0)