diff FEATURE add orig-default meta for all changed leaves
Not only when the default flag changes.
diff --git a/src/diff.c b/src/diff.c
index 3f5f5b4..08d100e 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -299,9 +299,7 @@
*/
/* orig-default */
- if ((options & LYD_DIFF_DEFAULTS) && (schema->nodetype == LYS_LEAFLIST) &&
- ((*op == LYD_DIFF_OP_REPLACE) || (*op == LYD_DIFF_OP_NONE)) &&
- ((first->flags & LYD_DEFAULT) != (second->flags & LYD_DEFAULT))) {
+ if ((schema->nodetype == LYS_LEAFLIST) && ((*op == LYD_DIFF_OP_REPLACE) || (*op == LYD_DIFF_OP_NONE))) {
if (first->flags & LYD_DEFAULT) {
*orig_default = "true";
} else {
@@ -460,9 +458,7 @@
*/
/* orig-default */
- if ((options & LYD_DIFF_DEFAULTS) && (schema->nodetype & LYD_NODE_TERM) &&
- ((*op == LYD_DIFF_OP_REPLACE) || (*op == LYD_DIFF_OP_NONE)) &&
- ((first->flags & LYD_DEFAULT) != (second->flags & LYD_DEFAULT))) {
+ if ((schema->nodetype & LYD_NODE_TERM) && ((*op == LYD_DIFF_OP_REPLACE) || (*op == LYD_DIFF_OP_NONE))) {
if (first->flags & LYD_DEFAULT) {
*orig_default = "true";
} else {
@@ -1233,6 +1229,10 @@
}
if (diff_match->schema->nodetype & LYD_NODE_TERM) {
+ /* add orig-dflt metadata */
+ LY_CHECK_RET(lyd_new_meta(LYD_CTX(src_diff), diff_match, NULL, "yang:orig-default",
+ trg_flags & LYD_DEFAULT ? "true" : "false", 0, NULL));
+
/* update dflt flag itself */
diff_match->flags &= ~LYD_DEFAULT;
diff_match->flags |= src_diff->flags & LYD_DEFAULT;