Skip to content

Commit b8ba153

Browse files
author
Junio C Hamano
committed
Fix twoway_merge that passed d/f conflict marker to merged_entry().
When switching from one tree to another, we should not send a marker that says "this file does not exist in the new tree -- I am a placeholder to tell you that, and not a real blob" down to merged_entry() as the result of the merge.
1 parent 2960a1d commit b8ba153

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

unpack-trees.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,20 +711,26 @@ int twoway_merge(struct cache_entry **src,
711711
struct unpack_trees_options *o)
712712
{
713713
struct cache_entry *current = src[0];
714-
struct cache_entry *oldtree = src[1], *newtree = src[2];
714+
struct cache_entry *oldtree = src[1];
715+
struct cache_entry *newtree = src[2];
715716

716717
if (o->merge_size != 2)
717718
return error("Cannot do a twoway merge of %d trees",
718719
o->merge_size);
719720

721+
if (oldtree == o->df_conflict_entry)
722+
oldtree = NULL;
723+
if (newtree == o->df_conflict_entry)
724+
newtree = NULL;
725+
720726
if (current) {
721727
if ((!oldtree && !newtree) || /* 4 and 5 */
722728
(!oldtree && newtree &&
723729
same(current, newtree)) || /* 6 and 7 */
724730
(oldtree && newtree &&
725731
same(oldtree, newtree)) || /* 14 and 15 */
726732
(oldtree && newtree &&
727-
!same(oldtree, newtree) && /* 18 and 19*/
733+
!same(oldtree, newtree) && /* 18 and 19 */
728734
same(current, newtree))) {
729735
return keep_entry(current, o);
730736
}

0 commit comments

Comments
 (0)