sageserpent-open / kineticMerge

Merge a heavily refactored codebase and stay sane.
MIT License
9 stars 1 forks source link

Resolve divergent moves when one is intra-file and the other inter-file. #32

Open sageserpent-open opened 3 months ago

sageserpent-open commented 3 months ago

This addresses the test failure seen in Git commit SHA: d5c60158f0c3f99c115b2aa22a1eec1c9063e617.

The problem there is a divergent move of a section that moves intra-file on one side and inter-file on the other. This is interpreted by the merge algebra for MergeResultDetectingMotion as being a coincident deletion of the source of a divergent move, so the coincident deletion is duly progagated to both move destinations.

However, when one move destination is intra-file and the other is inter-file, then it can make sense (certainly for the failing test case) to transpose the intra-file code motion into the destination file for the inter-file move. This is the case when the destination file is also the recipient of lots of other section moves from the same source file that aren't divergent - it seems obvious that the entire source file is simply being renamed, and the intra-file code motion is just an edit to be propagated.