summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/execution_engine')
-rw-r--r--src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp18
-rw-r--r--src/buildtool/execution_engine/tree_operations/tree_operations_utils.hpp5
2 files changed, 14 insertions, 9 deletions
diff --git a/src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp b/src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp
index 3943d5f4..8c1b0844 100644
--- a/src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp
+++ b/src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp
@@ -263,7 +263,9 @@ auto TreeOperationsUtils::ComputeTreeOverlay(
IExecutionApi const& api,
Artifact::ObjectInfo const& base_tree_info,
Artifact::ObjectInfo const& other_tree_info,
- bool disjoint) noexcept -> expected<Artifact::ObjectInfo, std::string> {
+ bool disjoint,
+ std::filesystem::path const& where) noexcept
+ -> expected<Artifact::ObjectInfo, std::string> {
// Ensure that both objects are actually trees.
Ensures(IsTreeObject(base_tree_info.type) and
IsTreeObject(other_tree_info.type));
@@ -311,8 +313,11 @@ auto TreeOperationsUtils::ComputeTreeOverlay(
if (IsTreeObject(base_entry.info.type) and
IsTreeObject(it->second.info.type)) {
// If both objects are trees, recursively compute tree overlay.
- auto tree_info = ComputeTreeOverlay(
- api, base_entry.info, it->second.info, disjoint);
+ auto tree_info = ComputeTreeOverlay(api,
+ base_entry.info,
+ it->second.info,
+ disjoint,
+ where / base_name);
if (not tree_info) {
return unexpected{tree_info.error()};
}
@@ -323,11 +328,8 @@ auto TreeOperationsUtils::ComputeTreeOverlay(
// If both objects are not trees, actual conflict detected.
if (disjoint) {
return unexpected{
- fmt::format("Conflict detected in tree-overlay computation {} "
- "vs {}:\n{} points to different objects: {} vs {}",
- base_tree_info.ToString(),
- other_tree_info.ToString(),
- nlohmann::json(base_name).dump(),
+ fmt::format("Conflict at path {}:\ndifferent objects {} vs {}",
+ nlohmann::json((where / base_name).string()).dump(),
base_entry.info.ToString(),
it->second.info.ToString())};
}
diff --git a/src/buildtool/execution_engine/tree_operations/tree_operations_utils.hpp b/src/buildtool/execution_engine/tree_operations/tree_operations_utils.hpp
index 62c405f4..bd818793 100644
--- a/src/buildtool/execution_engine/tree_operations/tree_operations_utils.hpp
+++ b/src/buildtool/execution_engine/tree_operations/tree_operations_utils.hpp
@@ -15,6 +15,7 @@
#ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_ENGINE_TREE_OPERATIONS_TREE_OPERATIONS_UTILS_HPP
#define INCLUDED_SRC_BUILDTOOL_EXECUTION_ENGINE_TREE_OPERATIONS_TREE_OPERATIONS_UTILS_HPP
+#include <filesystem>
#include <string>
#include "src/buildtool/common/artifact.hpp"
@@ -39,7 +40,9 @@ class TreeOperationsUtils final {
IExecutionApi const& api,
Artifact::ObjectInfo const& base_tree_info,
Artifact::ObjectInfo const& other_tree_info,
- bool disjoint) noexcept -> expected<Artifact::ObjectInfo, std::string>;
+ bool disjoint,
+ std::filesystem::path const& where = std::filesystem::path{}) noexcept
+ -> expected<Artifact::ObjectInfo, std::string>;
};
#endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_ENGINE_TREE_OPERATIONS_TREE_OPERATIONS_UTILS_HPP