wrong condition in threeWayMerge?
https://github.com/viebel/data-oriented-programming/blob/07bf95b4f4bedeb5cd9cdaa04e59b96efdf2727b/src/chapter05/consistency.js#L5
if(havePathInCommon(previousToCurrent, previousToNext)) { return _.merge(current, previousToNext); }
In the book, the explanation for the code above is:
"In order to determine whether there is a conflict, we calculate two diffs: the diff between previous and current and the diff between previous and next. If the intersection between the two diffs is empty, it means there is no conflict. We can safely patch the changes between previous to next into current."
Per my understanding the condition should be negated: if(**!**havePathInCommon(previousToCurrent, previousToNext)) { ...
It seems that the code throws exception if the intersection is empty.
You are absolutely correct. Could you open a PR?
@viebel I ran into the same thing and I've been confused, so I opened a PR for the correction. Would you mind checking this out? Thanks.
- https://github.com/viebel/data-oriented-programming/pull/20
Thank you. PR merged.