Please sign in to comment.
Fix ^:displace and ^:replace handling in meta-merge
An object with the metadata flag `:displace` set signals that, if a merge conflict appears, this object is to be discarded. Likewise, `^:replace` signals that this object should be kept in a merge conflict. However, previous functionality only tested if the right element had the `:replace` flag, or if the left element had the `:displace` flag. This commit resolves this by checking whether the left element has a `:replace` flag and the right element has a `:displace` flag, and handles accordingly to the semantics explained in the previous paragraph. Whenever two elements where both has the `:displace` flag is merged, the leftmost is picked, and their metadata is merged. Likewise for the `:replace` flag. The elements will not lose their `:displace` and `:replace` flags, as they have not really been preferred over another element. The `nil?` tests have been placed at the top to reflect that nil is the lack of a value, not a value itself. As such, elements will not be "preferred" or "discarded" over nil/nothing.
- Loading branch information...
Showing with 33 additions and 7 deletions.