merge-recursive: set paths correctly when three-way merging content
commit52396e1d3dd1417f042aa5269399bdcffe0a6c66
authorElijah Newren <newren@gmail.com>
Wed, 19 Sep 2018 16:14:31 +0000 (19 09:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Sep 2018 19:33:57 +0000 (20 12:33 -0700)
tree144421a4c6304d6f1b2f5a4be070420f368c7676
parent2d3b1c576c85b7f5db1f418907af00ab88e0c303
merge-recursive: set paths correctly when three-way merging content

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
3c217c077a86 ("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 dac4741554e7
("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: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c