viebel / data-oriented-programming

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong condition in threeWayMerge?

dilbert-ro opened this issue · comments

if(havePathInCommon(previousToCurrent, previousToNext)) {

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?