desktop: Merge hint count doesn't match actual conflicted files

The merge hint indicated there will be more conflicted files than what was showed in the actual merge conflict modal.

From four to three: screen shot 2018-11-05 at 9 12 43 am screen shot 2018-11-05 at 9 12 36 am

Reproduction may be difficult.

In command line:

Unmerged paths:
  (use "git add <file>..." to mark resolution)

	both added:      UnitTestProject1/UnitTestProject1.sln
	both added:      UnitTestProject1/UnitTestProject1/Properties/AssemblyInfo.cs
	both added:      UnitTestProject1/UnitTestProject1/UnitTestProject1.csproj

tested in 1.5.0-beta3, mac

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 17 (17 by maintainers)

Most upvoted comments

In working through the equivalent feature for the rebase flow I’ve stumbled upon an escape hatch that might mean we don’t need all that complexity from the proposed fix.

I’m currently testing the use of a worktree in a temporary directory to perform the merge . This means we could update the working directory using the exact same merge steps we use in the app, avoiding the need to use git merge-tree and then trying to cobble together the missing information that git merge-tree overlooks.

Based on my testing of #7445 I think the learnings and tools from there could be reused here. Stay tuned.

A theory that I’d like to unpack and explore (given a couple more real examples that I can test against) would be to test in two stages:

  • git merge-tree to find files that have been modified in both branches and cannot be merged automagically
  • run git diff-tree [merge-base]..[branch] for the base branch and the compare branch and filter on paths that will trigger the sort of conflict that blegh-test shows.

Why git diff-tree? This is a convenient way to see which paths have been changed on each branch, and shows the relevant context I think I need here:

Here’s the output for the previous merge scenario:

$ git diff-tree 2d0a39e2caaf16046214c98dbd856d658c3b88ee..master
:100644 100644 bc5563688c73fa22aed7d7241a0acfc39d403174 e6f4326b1552dcb7ff434888aaa0c030b4f93351 M	README.md
:000000 100644 0000000000000000000000000000000000000000 898e96c97c360cef274d2748a06bb21a6d536b7e A	asuperlongfilenamethatnoonewouldeveruseexceptmaybetheywould.md

$ git diff-tree 2d0a39e2caaf16046214c98dbd856d658c3b88ee..branch
:100644 000000 bc5563688c73fa22aed7d7241a0acfc39d403174 0000000000000000000000000000000000000000 D	README.md
:000000 100644 0000000000000000000000000000000000000000 898e96c97c360cef274d2748a06bb21a6d536b7e A	asuperlongfilenamethatnoonewouldeveruseexceptmaybetheywould.md

We see that each branch has made changes to the same two entries:

  • README.md is modified in one branch but deleted in the other - I think that’s the detail I’m missing
  • asuperlongfilenamethatnoonewouldeveruseexceptmaybetheywould.md is added in both with the same blob - if these differed content-wise I believe git merge-tree would try and merge the content and provide this detail to stdout.