thomasmueller commented on a change in pull request #513:
URL: https://github.com/apache/jackrabbit-oak/pull/513#discussion_r823675665
##########
File path:
oak-run/src/main/java/org/apache/jackrabbit/oak/index/merge/IndexDefMergerUtils.java
##########
@@ -148,6 +148,8 @@ private static String mergeProperty(String path, String
property, JsonObject anc
return cp;
} else if (Objects.equals(ap, cp)) {
return pp;
+ } else if (ap == null) {
+ return cp;
Review comment:
It would be good to add a comment, e.g.
// if it doesn't exist in the ancestor, prefer customization over the
product value
However, I'm not quite sure why this behavior is needed... shouldn't we
prefer pp (product)? Or maybe cp == pp ?
##########
File path:
oak-run/src/main/java/org/apache/jackrabbit/oak/index/merge/IndexDefMergerUtils.java
##########
@@ -163,7 +165,9 @@ private static JsonObject mergeChild(String path, String
child, int level, JsonO
if (level == 0 && USE_PRODUCT_CHILD_LEVEL_0.contains(child)) {
return p;
}
- if (isSameJson(a, p) || isSameJson(c, p)) {
+ if(c == null && p != null){
Review comment:
Spaces around "()" are missing
##########
File path:
oak-run/src/main/java/org/apache/jackrabbit/oak/index/merge/IndexDefMergerUtils.java
##########
@@ -163,7 +165,9 @@ private static JsonObject mergeChild(String path, String
child, int level, JsonO
if (level == 0 && USE_PRODUCT_CHILD_LEVEL_0.contains(child)) {
return p;
}
- if (isSameJson(a, p) || isSameJson(c, p)) {
+ if(c == null && p != null){
+ return p;
Review comment:
I would add a comment here as well, e.g.
// if customer removed it, then we put it back
##########
File path:
oak-run/src/main/java/org/apache/jackrabbit/oak/index/merge/IndexDefMergerUtils.java
##########
@@ -163,7 +165,9 @@ private static JsonObject mergeChild(String path, String
child, int level, JsonO
if (level == 0 && USE_PRODUCT_CHILD_LEVEL_0.contains(child)) {
return p;
}
- if (isSameJson(a, p) || isSameJson(c, p)) {
+ if(c == null && p != null){
+ return p;
+ }else if (isSameJson(a, p) || isSameJson(c, p)) {
Review comment:
space before "else" is missing
##########
File path:
oak-run/src/test/resources/org/apache/jackrabbit/oak/index/merge/merge.txt
##########
@@ -13,12 +13,6 @@
"product": {"o": {"a": 1, "p": 20}},
"expected": {"merges": ["/oak:index/test-2", "/oak:index/test-1-custom-1"],
"o": {"a": 2, "c": 10, "p": 20 }}
},
-{
- "ancestor": {"o": {"a": 1}},
- "custom": {},
- "product": {"o": {"a": 2}},
- "expected":"Conflicts detected: [Could not merge value; path=/o property=a;
ancestor=1; custom=null; product=2]"
-},
Review comment:
Instead of removing the test case, what about just changing the
"expected"?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]