From b4f79c7428c26815da0c4bb192f29b5b2b5a34b4 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Thu, 29 Jan 2026 20:50:07 -0600 Subject: T8232: Config_tree.get_subtree should preserve tag attribute at root This is useful when walking a subtree of a config tree, as is used in config_dict. --- src/config_tree.ml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/config_tree.ml b/src/config_tree.ml index 2f7d814..6a25c31 100644 --- a/src/config_tree.ml +++ b/src/config_tree.ml @@ -247,9 +247,21 @@ let get_subtree ?(with_node=false) node path = try let n = (Vytree.get[@alert "-exn"]) node path in if with_node then - Vytree.make_full default_data "" [n] + let data = + (* preserve tag attribute *) + match (is_tag_value node path) with + | true -> {default_data with tag = true} + | false -> default_data + in + Vytree.make_full data "" [n] else - Vytree.make_full default_data "" (Vytree.children_of_node n) + let data = + (* preserve tag attribute *) + match (is_tag node path) with + | true -> {default_data with tag = true} + | false -> default_data + in + Vytree.make_full data "" (Vytree.children_of_node n) with Vytree.Nonexistent_path -> make "" let value_paths_of_tree node = -- cgit v1.2.3