diff BUGFIX no descendants for user-ord lists
No need to include them in the diff and if
there, they are expected to have an operation.
diff --git a/src/diff.c b/src/diff.c
index fd72132..0625bc9 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -366,13 +366,18 @@
dup = diff_parent;
} else {
+ diff_opts = LYD_DUP_NO_META | LYD_DUP_WITH_PARENTS | LYD_DUP_WITH_FLAGS;
+ if ((op != LYD_DIFF_OP_REPLACE) || !lysc_is_userordered(node->schema) || (node->schema->flags & LYS_CONFIG_R)) {
+ /* move applies only to the user-ordered list, no descendants */
+ diff_opts |= LYD_DUP_RECURSIVE;
+ }
+
/* duplicate the subtree (and connect to the diff if possible) */
if (diff_parent) {
LY_CHECK_RET(lyd_dup_single_to_ctx(node, LYD_CTX(diff_parent), (struct lyd_node_inner *)diff_parent,
- LYD_DUP_RECURSIVE | LYD_DUP_NO_META | LYD_DUP_WITH_PARENTS | LYD_DUP_WITH_FLAGS, &dup));
+ diff_opts, &dup));
} else {
- LY_CHECK_RET(lyd_dup_single(node, NULL,
- LYD_DUP_RECURSIVE | LYD_DUP_NO_META | LYD_DUP_WITH_PARENTS | LYD_DUP_WITH_FLAGS, &dup));
+ LY_CHECK_RET(lyd_dup_single(node, NULL, diff_opts, &dup));
}
/* find the first duplicated parent */