data tree FEATURE implement LYD_DUP_WITH_FLAGS
diff --git a/src/tree_data.c b/src/tree_data.c
index 01a4a33..7ec7004 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1980,8 +1980,11 @@
}
LY_CHECK_ERR_GOTO(!dup, LOGMEM(LYD_NODE_CTX(node)); ret = LY_EMEM, error);
- /* TODO implement LYD_DUP_WITH_WHEN */
- dup->flags = node->flags;
+ if (options & LYD_DUP_WITH_FLAGS) {
+ dup->flags = node->flags;
+ } else {
+ dup->flags = (node->flags & LYD_DEFAULT) | LYD_NEW;
+ }
dup->schema = node->schema;
dup->prev = dup;