• E
    merge-recursive: set paths correctly when three-way merging content · 52396e1d
    Elijah Newren 提交于
    merge_3way() has code to mark different sides of the conflict with info
    about where the content comes from.  If the names of the files involved
    match, it simply uses the branch name.  If the names of the files do not
    match, it uses branchname:filename.  Unfortunately, merge_content()
    previously always called it with one.path = a.path = b.path.  Granted,
    it didn't have other path information available to it for years, but
    that was corrected by passing rename_conflict_info in commit
    3c217c07 ("merge-recursive: Provide more info in conflict markers
    with file renames", 2011-08-11).  In that commit, instead of just fixing
    the bug with the pathnames, it created fake branch names incorporating
    both the branch name and file name.
    
    This "fake branch" workaround was extended further when I pulled that
    logic out into a special function in commit dac47415
    ("merge-recursive: Create function for merging with branchname:file
    markers", 2011-08-11), and a number of other sites outside of
    merge_content() have been added which call into that.  However, this
    Rube-Goldberg-esque setup is not merely duplicate code and unnecessary
    work, it also risked having other callsites invoke it in a way that
    would result in markers of the form branchname:filename:filename (i.e.
    with the filename repeated).
    
    Fix this whole mess by:
      - setting one.path, a.path, and b.path appropriately
      - calling merge_file_1() directly
      - deleting the merge_file_special_markers() workaround wrapper
    Signed-off-by: NElijah Newren <newren@gmail.com>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    52396e1d
merge-recursive.c 104.8 KB