Why do two identical peices of code cause so many conflicts in intellij's three way diff?

Viewed 31

Edit:

My original question with blurred code may have made what I was asking about unclear, so I made a better (albeit contrived) example without obscured code here:

https://gfycat.com/dizzyinsidiousavians (Switch the toggle to HD for legible code)

In the process of making that clip I believe I also came around to an understanding of what is happening.

As you can see in the video, after modifying the base version (center column) to match the local copy (left column) exactly I was confused by the lingering indicators still showing differences that no longer existed.

It would have been more intuitive to me that after the changes were applied/removed, the indicators would clear. That happens though seemingly only if you interact with them directly to make the changes.


Original Question:

I am manually resolving a merge conflict in intellij.

Below is a image of the issue (sorry for the blurred code) which has two screenshots: the main one, and an inlaid one.

The main screenshot shows the left two panels which have identical code, but are reporting conflicts. I am trying to understand why this code is not recognized as the same when it is indeed the same - white-space and all. (the third panel is only barely shown on the right edge)

The inlay shows the result of just diffing the left two panels and shows correctly that there are no differences.

Any clue why this would be or what can be done about it?

Image of the problem diff https://i.stack.imgur.com/yrgjm.png

1 Answers

The comparison is done between "left" and "middle", and knowing how IntelliJ "Resolve Git conflicts":

  • The left pane shows the read-only local copy
  • The right pane shows the read-only version checked in to the repository.
  • The central pane is a fully-functional editor where the results of resolving conflicts are displayed. Initially, the contents of this pane are the same as the base revision of the file, that is, the revision from which both conflicting versions are derived.

If your local version is the same as the base revision of the file, that is, the revision from which both conflicting versions are derived, then a diff between left and middle would be default be identical.

A diff between left and right shows differences, as seen in your screenshot.

Related