Skip to content
  • Elijah Newren's avatar
    merge-recursive: Fix modify/delete resolution in the recursive case · ec61d149
    Elijah Newren authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When o->call_depth>0 and we have conflicts, we try to find "middle ground"
    when creating the virtual merge base.  In the case of content conflicts,
    this can be done by doing a three-way content merge and using the result.
    In all parts where the three-way content merge is clean, it is the correct
    middle ground, and in parts where it conflicts there is no middle ground
    but the conflict markers provide a good compromise since they are unlikely
    to accidentally match any further changes.
    
    In the case of a modify/delete conflict, we cannot do the same thing.
    Accepting either endpoint as the resolution for the virtual merge base
    runs the risk that when handling the non-recursive case we will silently
    accept one person's resolution over another without flagging a conflict.
    In this case, the closest "middle ground" we have is actually the merge
    base of the candidate merge bases.  (We could alternatively attempt a
    three way content merge using an empty file in place of the deleted file,
    but that seems to be more work than necessary.)
    
    Signed-off-by: default avatarElijah Newren <newren@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    ec61d149