Handle all classes of merge conflicts and display them properly in diff
## Classes of conflicts: *User - a user who creates a branch, commits changes, and views them in diff *TB-User - Target Branch User - a user who commits changes to the target branch after the User's branch has been created and creates a conflict #### 1. Both modified the same file - User modified file A - TB-User modified file A in the same place The conflict can be displayed as: ```diff >>>>>>> changes of User ======= changes of TB-User <<<<<<< ``` #### 2. Modified in source, removed in target - User modified file A - TB-User removed file A We can display User's changes in diff but with an explicit message that the file has been removed in the target branch #### 3. Removed in source, modified in target - User removed file A - TB-User modified file A We can display User's changes in diff but with an explicit message that the file has been modified in the target branch #### 4. Renamed the same file differently - User renamed file A to B - TB-User renamed file A to C We can display User's name for the file in diff but with an explicit message that the file has been renamed in the target branch as well #### 5. Removed in source, renamed in target - User removed file A - TB-User renamed file A to B We can display User's changes for the file in diff but with an explicit message that the file has been renamed in the target branch #### 6. Renamed in source, removed in target - User renamed file A to B - TB-User removed file A We can display User's changes for the file in diff but with an explicit message that the file has been removed in the target branch #### 7. Both added the same file - User added file A - TB-User added file A with different content The conflict can be displayed as: ```diff >>>>>>> content of A added by User ======= content of A added by TB-User <<<<<<< ``` ## Current state #### 1. On-going work regarding merge-ref-head diffs Within https://gitlab.com/gitlab-org/gitlab/-/issues/232484 we've handled only the first case (both-modified). The purpose of this issue is to initiate the work of handling all the cases properly. #### 2. Resolve-conflicts page At the moment it's possible only for the 1 and 7 cases: ![Screen_Shot_2020-10-14_at_10.51.56](https://gitlab.com/gitlab-org/gitlab/uploads/2a014a4ad0191ef18ccb892502b3ca44/Screen_Shot_2020-10-14_at_10.51.56.png) For the other cases, we suggest to resolve the conflicts locally: ![Screen_Shot_2020-10-14_at_10.56.27](https://gitlab.com/gitlab-org/gitlab/uploads/6f444b7aa3fbc28b7e61a9b3efe8e733/Screen_Shot_2020-10-14_at_10.56.27.png) <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION --> *This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.* <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION -->
issue