From d3c656c06505d23d847e4f704be5c27c6c3ccef4 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 18 Dec 2023 16:49:13 +0100 Subject: Fix just-mr handling of --absent If the option --absent is given in just-mr (either directly or implicitly via the corresponding entry in the rc file), it rewrites the "pragma" entries in the internal representation of the mr repository config. When doing so, however, we have to take into consideration that a workspace root is not necessarily the definition of a repository, but can, alternatively, also be a reference to another root. This was not taken into account; fix this by restricting the rewriting to only json objects. --- src/other_tools/just_mr/setup_utils.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/other_tools/just_mr/setup_utils.cpp') diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp index 839b47a3..9eaa2e86 100644 --- a/src/other_tools/just_mr/setup_utils.cpp +++ b/src/other_tools/just_mr/setup_utils.cpp @@ -216,10 +216,12 @@ auto ReadConfiguration( for (auto const& [key, val] : repos.items()) { new_repos[key] = val; auto ws = val.value("repository", nlohmann::json::object()); - auto pragma = ws.value("pragma", nlohmann::json::object()); - pragma["absent"] = absent_set.contains(key); - ws["pragma"] = pragma; - new_repos[key]["repository"] = ws; + if (ws.is_object()) { + auto pragma = ws.value("pragma", nlohmann::json::object()); + pragma["absent"] = absent_set.contains(key); + ws["pragma"] = pragma; + new_repos[key]["repository"] = ws; + } } config["repositories"] = new_repos; } catch (std::exception const& e) { -- cgit v1.2.3