+2

Give access to conflict solver even on non-conflicted files

griscom 3 years ago updated 10 months ago 5

I'm doing a complex merge between two branches. The five files with conflicts let me use the Conflict Solver to compare the two source branches to the mis-merged file, so I was able to resolve and stage the issues. Now, though, I have 365 changed, staged files, and I'd like to review the changes. I can see how they differ from the previous version of the master branch, but there's no way to see how they differ from the merged branch.

I'd like to access the Conflict Solver, but it's dimmed out. Even if I un-stage the files, it's still dimmed out.

Please allow use of the Conflict Solver on any file during a merge. Ideally I wouldn't have to un-stage each file to use it, but ideally I'd also be able to edit the merged file; not sure how you'd make both options possible.

To see the changes against the merged branch, please select the working tree and the latest commit of the merged branch.

That will compare the working tree with the merged branch, but not show anything about the target branch. In otherwise, it just shows two file states and their differences. (right?)

The "Conflict Solver" shows three file states: the merged branch, the target branch, and the working tree in the middle. I can see where any change came from, and what's different from either source. Would be very useful.

When a file is in conflicting state, the .git/index contains stages 1,2 and 3 for the file. These point exactly to the file contents which have been used by Git's merge and these are the file contents which SmartGit's Conflict Solver will display. Once you stage a file, these .git/index entries are removed and replaced by a stage 0 entry (which means a normal file). Hence, SmartGit has not enough information anymore to display the Conflict Solver. A good summary can be found here:

https://stackoverflow.com/a/65968958

Without re-implementing too much of Git's internal logic, SmartGit may be able to get the three stages back using "git checkout --merge", however this will also overwrite the current working tree content:

https://stackoverflow.com/questions/61172881

Good information. However, doesn't SmartGit technically have all the information it needs, since it knows the parent commits that were merged, and thus the two states of the two files being merged? So, it could open the Conflict Solver showing one parent on the left and the other parent on the right, maintaining the merged content, but without Git's underlying support.

(That said, I wouldn't be at all surprised if bypassing Git's merge system would be a complete PIA for Smart Git.)